[node-patches] Change in ovirt-node[master]: [SNMP] Make the SNMP plugin work on newer distros

fabiand at fedoraproject.org fabiand at fedoraproject.org
Fri Nov 8 13:15:18 UTC 2013


Fabian Deutsch has posted comments on this change.

Change subject: [SNMP] Make the SNMP plugin work on newer distros
......................................................................


Patch Set 1: Code-Review-1

(3 comments)

....................................................
File src/ovirt/node/setup/snmp/snmp_model.py
Line 55:         # Only reached when no excepion occurs
Line 56:         process.call(["rm", "-rf", "/tmp/snmpd.conf"])
Line 57:     ovirt_store_config(snmp_conf)
Line 58: 
Line 59:     if not any([x for x in open('/etc/snmp/snmpd.conf').readlines()
Please use for x in File(...) here (this will iterate over lines)

Using File() allows us to mock when writing unittests
Line 60:                 if 'rwuser root' in x]):
Line 61:         with open('/etc/snmp/snmpd.conf', 'a') as f:
Line 62:             f.write("rwuser root")
Line 63:     ovirt_store_config('/etc/snmp/snmpd.conf')


Line 57:     ovirt_store_config(snmp_conf)
Line 58: 
Line 59:     if not any([x for x in open('/etc/snmp/snmpd.conf').readlines()
Line 60:                 if 'rwuser root' in x]):
Line 61:         with open('/etc/snmp/snmpd.conf', 'a') as f:
Please also use File(...) here
Line 62:             f.write("rwuser root")
Line 63:     ovirt_store_config('/etc/snmp/snmpd.conf')
Line 64: 
Line 65:     system.service("snmpd", "start")


Line 59:     if not any([x for x in open('/etc/snmp/snmpd.conf').readlines()
Line 60:                 if 'rwuser root' in x]):
Line 61:         with open('/etc/snmp/snmpd.conf', 'a') as f:
Line 62:             f.write("rwuser root")
Line 63:     ovirt_store_config('/etc/snmp/snmpd.conf')
fs.Config can be used here
Line 64: 
Line 65:     system.service("snmpd", "start")
Line 66: 
Line 67: 


-- 
To view, visit http://gerrit.ovirt.org/20375
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I1aac2dd19d3d86be610faea5c71c9d94ce2e63b0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
Gerrit-Reviewer: Fabian Deutsch <fabiand at fedoraproject.org>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes



More information about the node-patches mailing list