[node-patches] Change in ovirt-node[ovirt-3.6]: Persist all of /var/lib/net-snmp instead of just snmpd.conf

fabiand at redhat.com fabiand at redhat.com
Mon Nov 23 17:23:37 UTC 2015


Fabian Deutsch has uploaded a new change for review.

Change subject: Persist all of /var/lib/net-snmp instead of just snmpd.conf
......................................................................

Persist all of /var/lib/net-snmp instead of just snmpd.conf

snmpd wants to rename the files, so persist the entire dir so this
works as expected...

Change-Id: Ifef49615cca8eae9107d3ea409db30f71c2815ae
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1261424
Signed-off-by: Ryan Barry <rbarry at redhat.com>
(cherry picked from commit b27667f415f06e08491a7029d1db198c3724ccf1)
---
M src/ovirt/node/setup/snmp/snmp_model.py
1 file changed, 5 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/33/49033/1

diff --git a/src/ovirt/node/setup/snmp/snmp_model.py b/src/ovirt/node/setup/snmp/snmp_model.py
index 7a882e7..5be0507 100644
--- a/src/ovirt/node/setup/snmp/snmp_model.py
+++ b/src/ovirt/node/setup/snmp/snmp_model.py
@@ -24,7 +24,8 @@
 import os.path
 
 
-snmp_conf = "/var/lib/net-snmp/snmpd.conf"
+snmp_conf = "/var/lib/net-snmp/"
+old_conf = "/var/lib/net-snmp/snmpd.conf"
 
 
 def enable_snmpd(password):
@@ -50,15 +51,11 @@
         change_password(oldpwd)
     else:
         system.service("snmpd", "stop")
-        # net-snmp tries to move this to a backup. We don't care about that,
-        # but it fails, and fails to create the user if it's persisted (and
-        # bind mounted).
-        fs.Config().unpersist(snmp_conf)
         # create user account
         process.check_call(["net-snmp-create-v3-user", "-A", password, "-a",
                             "SHA", "-x", "AES", "root"])
         system.service("snmpd", "start")
-        fs.Config().persist("/etc/snmp/snmpd.conf")
+
         fs.Config().persist(snmp_conf)
 
     firewall.open_port(port="161", proto="udp")
@@ -70,7 +67,8 @@
     process.check_call(["cp", "/etc/snmp/snmpd.conf", "/tmp"])
     process.check_call("sed -c -ie '/^createUser root/d' %s" % snmp_conf,
                        shell=True)
-    fs.Config().unpersist(snmp_conf)
+    configs = [snmp_conf, old_conf]
+    [fs.Config().unpersist(c) for c in configs if fs.Config().exists(c)]
 
 
 class SNMP(NodeConfigFileSection):


-- 
To view, visit https://gerrit.ovirt.org/49033
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifef49615cca8eae9107d3ea409db30f71c2815ae
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Fabian Deutsch <fabiand at redhat.com>



More information about the node-patches mailing list