diff options
author | Ben Howard <ben.howard@ubuntu.com> | 2015-12-07 16:48:51 -0700 |
---|---|---|
committer | usd-importer <ubuntu-server@lists.ubuntu.com> | 2015-12-08 16:10:11 +0000 |
commit | 542c7a834728ad35d7f5f98cacdf78d86721656f (patch) | |
tree | 6850cbc7ce3dec800c1b50f23da6b76077198159 /azurelinuxagent/distro/redhat/osutil.py | |
parent | f6e3f158c2fb9021b37654ea20839ec7a4308d52 (diff) | |
parent | f4e6aca60e419eafbdf11bdd631d35cf785735ae (diff) | |
download | vyos-walinuxagent-542c7a834728ad35d7f5f98cacdf78d86721656f.tar.gz vyos-walinuxagent-542c7a834728ad35d7f5f98cacdf78d86721656f.zip |
Import patches-applied version 2.1.2-0ubuntu1 to applied/ubuntu/xenial-proposed
Imported using git-ubuntu import.
Changelog parent: f6e3f158c2fb9021b37654ea20839ec7a4308d52
Unapplied parent: f4e6aca60e419eafbdf11bdd631d35cf785735ae
New changelog entries:
* New upstream release (LP: #1523715):
- Bug fixes for Ubuntu 15.10 on Azure
- Enablement for Azure Stack
- Dropped patch for systemd job as upstream now includes it.
Diffstat (limited to 'azurelinuxagent/distro/redhat/osutil.py')
-rw-r--r-- | azurelinuxagent/distro/redhat/osutil.py | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/azurelinuxagent/distro/redhat/osutil.py b/azurelinuxagent/distro/redhat/osutil.py index c6c3016..7478867 100644 --- a/azurelinuxagent/distro/redhat/osutil.py +++ b/azurelinuxagent/distro/redhat/osutil.py @@ -122,15 +122,14 @@ class Redhat6xOSUtil(DefaultOSUtil): ret= shellutil.run_get_output("pidof dhclient") return ret[1] if ret[0] == 0 else None -class RedhatOSUtil(Redhat6xOSUtil): - def __init__(self): - super(RedhatOSUtil, self).__init__() - def set_hostname(self, hostname): - super(RedhatOSUtil, self).set_hostname(hostname) + """ + Set /etc/sysconfig/network + """ fileutil.update_conf_file('/etc/sysconfig/network', 'HOSTNAME', 'HOSTNAME={0}'.format(hostname)) + shellutil.run("hostname {0}".format(hostname), chk_err=False) def set_dhcp_hostname(self, hostname): ifname = self.get_if_name() @@ -139,6 +138,24 @@ class RedhatOSUtil(Redhat6xOSUtil): 'DHCP_HOSTNAME', 'DHCP_HOSTNAME={0}'.format(hostname)) +class RedhatOSUtil(Redhat6xOSUtil): + def __init__(self): + super(RedhatOSUtil, self).__init__() + + def set_hostname(self, hostname): + """ + Set /etc/hostname + Unlike redhat 6.x, redhat 7.x will set hostname to /etc/hostname + """ + DefaultOSUtil.set_hostname(self, hostname) + + def publish_hostname(self, hostname): + """ + Restart NetworkManager first before publishing hostname + """ + shellutil.run("service NetworkManager restart") + super(RedhatOSUtil, self).publish_hostname(hostname) + def register_agent_service(self): return shellutil.run("systemctl enable waagent", chk_err=False) |