diff options
author | Ben Howard <ben.howard@ubuntu.com> | 2012-11-14 10:59:37 -0700 |
---|---|---|
committer | usd-importer <ubuntu-server@lists.ubuntu.com> | 2012-11-15 16:03:16 +0000 |
commit | 3ea0baa1d61ba26b51fb5f88d70f85d19db2bd70 (patch) | |
tree | de2fc3ca1978ffa00ce2da1a6165514fa4fa9a2b | |
parent | 49a663c4bc1499f974cca254a9c13016c4382a1b (diff) | |
download | vyos-walinuxagent-3ea0baa1d61ba26b51fb5f88d70f85d19db2bd70.tar.gz vyos-walinuxagent-3ea0baa1d61ba26b51fb5f88d70f85d19db2bd70.zip |
000_resolv-conf.patch
No DEP3 Subject or Description header found
Gbp-Pq: 000_resolv-conf.patch.
-rw-r--r-- | waagent | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -2262,7 +2262,26 @@ def Deprovision(force, deluser): Run("rm -f " + a + "/*") # Clear LibDir, remove nameserver and root bash history - for f in os.listdir(LibDir) + ["/etc/resolv.conf", "/root/.bash_history", "/var/log/waagent.log"]: + fileBlackList = [ "/root/.bash_history", "/var/log/waagent.log" ] + + if IsUbuntu(): + # Ubuntu uses resolv.conf by default, so removing /etc/resolv.conf will + # break resolvconf. Therefore, we check to see if resolvconf is in use, + # and if so, we remove the resolvconf artifacts. + + if os.path.realpath('/etc/resolv.conf') != '/run/resolvconf/resolv.conf': + Log("resolvconf is not configured. Removing /etc/resolv.conf") + fileBlackList.append('/etc/resolv.conf') + else: + Log("resolvconf is enabled; leaving /etc/resolv.conf intact") + resolvConfD = '/etc/resolvconf/resolv.conf.d/' + fileBlackList.extend([resolvConfD + 'tail', resolvConfD + 'originial' ]) + else: + fileBlackList.append(os.listdir(LibDir) + '/etc/resolv.conf') + + + # Clear LibDir, remove nameserver and root bash history + for f in os.listdir(LibDir) + fileBlackList: try: os.remove(f) except: |