Ryan Barry has uploaded a new change for review. Change subject: [SNMP] Make the SNMP plugin work on newer distros ......................................................................
[SNMP] Make the SNMP plugin work on newer distros Create users in /var/lib/net-snmp instead of /etc/snmp so it gets correclty processed. Change-Id: I1aac2dd19d3d86be610faea5c71c9d94ce2e63b0 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1021559 Signed-off-by: Ryan Barry <[email protected]> --- M recipe/common-post.ks M src/ovirt/node/setup/snmp/snmp_model.py 2 files changed, 11 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/75/20375/1 diff --git a/recipe/common-post.ks b/recipe/common-post.ks index 26702b5..4b29c0a 100644 --- a/recipe/common-post.ks +++ b/recipe/common-post.ks @@ -88,7 +88,7 @@ cat > /etc/rwtab.d/ovirt << \EOF_rwtab_ovirt files /etc dirs /var/lib/multipath -dirs /var/lib/net-snmp +files /var/lib/net-snmp dirs /var/lib/dnsmasq files /root/.ssh dirs /root/.uml diff --git a/src/ovirt/node/setup/snmp/snmp_model.py b/src/ovirt/node/setup/snmp/snmp_model.py index 0f18ab4..a6999b6 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 = "/etc/snmp/snmpd.conf" +snmp_conf = "/var/lib/net-snmp/snmpd.conf" def enable_snmpd(password): @@ -45,7 +45,7 @@ # create user account f.write("createUser root SHA %s AES\n" % password) f.close() - system.service("snmpd", "start") + # change existing password if len(oldpwd) > 0: pwd_change_cmd = (("snmpusm -v 3 -u root -n \"\" -l authNoPriv -a " + @@ -56,6 +56,14 @@ process.call(["rm", "-rf", "/tmp/snmpd.conf"]) ovirt_store_config(snmp_conf) + if not any([x for x in open('/etc/snmp/snmpd.conf').readlines() + if 'rwuser root' in x]): + with open('/etc/snmp/snmpd.conf', 'a') as f: + f.write("rwuser root") + ovirt_store_config('/etc/snmp/snmpd.conf') + + system.service("snmpd", "start") + def disable_snmpd(): from ovirtnode.ovirtfunctions import remove_config -- To view, visit http://gerrit.ovirt.org/20375 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1aac2dd19d3d86be610faea5c71c9d94ce2e63b0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Ryan Barry <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
