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

rbarry at redhat.com rbarry at redhat.com
Tue Sep 22 15:57:27 UTC 2015


Ryan Barry 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>
---
M src/ovirt/node/setup/snmp/snmp_model.py
1 file changed, 4 insertions(+), 7 deletions(-)


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

diff --git a/src/ovirt/node/setup/snmp/snmp_model.py b/src/ovirt/node/setup/snmp/snmp_model.py
index 7a882e7..126d412 100644
--- a/src/ovirt/node/setup/snmp/snmp_model.py
+++ b/src/ovirt/node/setup/snmp/snmp_model.py
@@ -24,7 +24,7 @@
 import os.path
 
 
-snmp_conf = "/var/lib/net-snmp/snmpd.conf"
+snmp_conf = "/var/lib/net-snmp/"
 
 
 def enable_snmpd(password):
@@ -50,16 +50,13 @@
         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)
+
+        configs = ["/etc/snmp/snmpd.conf", snmp_conf]
+        [fs.Config().persist(c) for c in configs if not fs.Config().exists(c)]
 
     firewall.open_port(port="161", proto="udp")
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifef49615cca8eae9107d3ea409db30f71c2815ae
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list