diff options
Diffstat (limited to 'common/scripts/IFCFG.pm')
-rw-r--r-- | common/scripts/IFCFG.pm | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/common/scripts/IFCFG.pm b/common/scripts/IFCFG.pm index 2d1171ba..669525f7 100644 --- a/common/scripts/IFCFG.pm +++ b/common/scripts/IFCFG.pm @@ -43,6 +43,8 @@ sub new { } } %{$self->{network}} = getVarsFromSh("/etc/sysconfig/network"); + $self->{network}{HOSTNAME} ||= `hostname` and chomp $self->{network}{HOSTNAME}; + ($self->{network}{DOMAINNAME}) = $self->{network}{HOSTNAME} =~ /\.(.*)/ || (`dnsdomainname`) and chomp $self->{network}{DOMAINNAME}; bless $self; } @@ -72,7 +74,7 @@ sub network_get { my $self = shift; my ($key) = @_; - exists $self->{network}->{$key} or die "no $key field in network hash"; + exists $self->{network}{$key} or die "no $key field in network hash"; $self->{network}{$key}; } |