Skip to content

Commit

Permalink
ncm-network core schema: allow realhostname to be a short hostname
Browse files Browse the repository at this point in the history
- Allow better support of software like Ceph where it is the recommended
setting
  • Loading branch information
jouvin committed Jun 28, 2023
1 parent fe40b10 commit 4e8cd16
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ type structure_ipv6 = {
type structure_network = {
"domainname" : type_fqdn
"hostname" : type_shorthostname
"realhostname" ? type_fqdn
"realhostname" ? string with is_shorthostname(SELF) || is_fqdn(SELF)
"default_gateway" ? type_ip
@{When default_gateway is not set, the component will try to guess the default
gateway using the first configured gateway set on an interface.
Expand Down
13 changes: 13 additions & 0 deletions ncm-network/src/test/perl/simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,19 @@ ok(command_history_ok([
]), "hostnamectl called with realhostname");


command_history_reset();
$cfg = get_config_for_profile('simple_shortrealhostname');
$executables{'/usr/bin/hostnamectl'} = 1;
is($cmp->Configure($cfg), 1, "Component runs correctly with shortrealhostname test profile w hostnamectl");
unlike(get_file_contents("/etc/sysconfig/network"),
qr/HOSTNAME=/m,
"shortrealhostname not used as hostname w hostnamectl");
ok(command_history_ok([
'/usr/bin/hostnamectl set-hostname shortrealhost --static',
]), "hostnamectl called with shortrealhostname");



# removing broadcast that was same as computed default is ok (triggers no network restart)

set_desired_output('ipcalc --broadcast 4.3.2.1 255.255.255.0', "BROADCAST=4.3.2.255\n");
Expand Down
5 changes: 5 additions & 0 deletions ncm-network/src/test/resources/simple_shortrealhostname.pan
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object template simple_shortrealhostname;

include 'simple_base_profile';

"/system/network/realhostname" = "shortrealhost";

0 comments on commit 4e8cd16

Please sign in to comment.