[node-patches] Change in ovirt-node[master]: network/tui: Removing of DNS servers works now
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Fri Nov 23 11:12:13 UTC 2012
Fabian Deutsch has uploaded a new change for review.
Change subject: network/tui: Removing of DNS servers works now
......................................................................
network/tui: Removing of DNS servers works now
The previous solution for removing DNS/NTP servers did not work well
when a DNS server was set and directly removed again prior to logging
out (a corener case). The reason is that the removal of the OVIRT_DNS
defaults entry wasn't reflected in the global OVIRT_VARS variable.
Now the DNS servers are removed also in the case if OVIRT_DNS is empty,
previously the DNS servers were only removed if the key did not exist.
rhbz#870436
Change-Id: Ie141cdd7dcea3ae488f8a4dacb0b7f6c8a8aac88
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirt-config-setup.py
M scripts/ovirtnode/network.py
2 files changed, 8 insertions(+), 12 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/32/9432/1
diff --git a/scripts/ovirt-config-setup.py b/scripts/ovirt-config-setup.py
index 6069464..ed88bc4 100755
--- a/scripts/ovirt-config-setup.py
+++ b/scripts/ovirt-config-setup.py
@@ -1539,19 +1539,15 @@
# Save DNS servers
dns_servers = ",".join(dns_servers)
- if dns_servers:
- augtool("set", "/files/" + OVIRT_DEFAULTS + "/OVIRT_DNS",
- '"' + dns_servers + '"')
- else:
- augtool("rm", "/files/" + OVIRT_DEFAULTS + "/OVIRT_DNS", "")
+ logger.debug("Setting DNS defaults to: %s" % dns_servers)
+ augtool("set", "/files/" + OVIRT_DEFAULTS + "/OVIRT_DNS",
+ '"' + dns_servers + '"')
# Save NTP servers
ntp_servers = ",".join(ntp_servers)
- if ntp_servers:
- augtool("set", "/files/" + OVIRT_DEFAULTS + "/OVIRT_NTP",
- '"' + ntp_servers + '"')
- else:
- augtool("rm", "/files/" + OVIRT_DEFAULTS + "/OVIRT_NTP", "")
+ logger.debug("Setting NTP defaults to: %s" % ntp_servers)
+ augtool("set", "/files/" + OVIRT_DEFAULTS + "/OVIRT_NTP",
+ '"' + ntp_servers + '"')
aug.load()
diff --git a/scripts/ovirtnode/network.py b/scripts/ovirtnode/network.py
index 6f07628..04d106a 100644
--- a/scripts/ovirtnode/network.py
+++ b/scripts/ovirtnode/network.py
@@ -237,9 +237,9 @@
# Remove all spare DNS servers
logger.debug("Removing DNS servers")
if len(DNS) < 2:
- _functions.augtool("rm", "/files/etc/resolv.conf/nameserver[1]", "")
+ _functions.augtool("rm", "/files/etc/resolv.conf/nameserver[2]", "")
if len(DNS) < 1:
- _functions.augtool("rm", "/files/etc/resolv.conf/nameserver", "")
+ _functions.augtool("rm", "/files/etc/resolv.conf/nameserver[1]", "")
# Set or remove PEERDNS for all ifcfg-*
for nic in glob("/etc/sysconfig/network-scripts/ifcfg-*"):
--
To view, visit http://gerrit.ovirt.org/9432
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie141cdd7dcea3ae488f8a4dacb0b7f6c8a8aac88
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list