Bug 999146 - Error in fencing_snmp.py on line 73
Error in fencing_snmp.py on line 73
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: fence-agents (Show other bugs)
rawhide
x86_64 Linux
unspecified Severity high
: ---
: ---
Assigned To: Fabio Massimo Di Nitto
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 1022525
  Show dependency treegraph
 
Reported: 2013-08-20 15:46 EDT by Tim Schoondergang
Modified: 2013-10-23 09:10 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1022525 (view as bug list)
Environment:
Last Closed: 2013-08-30 03:37:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
corrected file (3.98 KB, text/x-python)
2013-08-20 15:47 EDT, Tim Schoondergang
no flags Details

  None (edit)
Description Tim Schoondergang 2013-08-20 15:46:09 EDT
Description of problem:
fencing_snmp.py returns KeyError: '--a'
and the fencing will fail

Version-Release number of selected component (if applicable):
4.0.2

How reproducible:
Always in combination of fence_intelmodular

Steps to Reproduce:
1. /usr/sbin/fence_intelmodular --action=status --ip=XXX.XXX.XXX.XXX --username=snmpv3user --password=XXXXXXXXXX --snmp-version=3 --snmp-auth-prot=SHA --verbose --plug=3 --snmp-sec-level=auth


Actual results:
Traceback (most recent call last):
  File "/usr/sbin/fence_intelmodular", line 92, in <module>
    main()
  File "/usr/sbin/fence_intelmodular", line 87, in main
    result = fence_action(FencingSnmp(options), options, set_power_status, get_power_status, get_outlets_status)
  File "/usr/share/fence/fencing.py", line 810, in fence_action
    status = get_multi_power_fn(tn, options, get_power_fn)
  File "/usr/share/fence/fencing.py", line 743, in get_multi_power_fn
    plug_status = get_power_fn(tn, options)
  File "/usr/sbin/fence_intelmodular", line 41, in get_power_status
    (oid, status) = conn.get("%s.%s"% (STATUSES_OID, options["--plug"]))
  File "/usr/share/fence/fencing_snmp.py", line 106, in get
    cmd = "%s '%s'"% (self.prepare_cmd("snmpget"), self.quote_for_run(oid))
  File "/usr/share/fence/fencing_snmp.py", line 73, in prepare_cmd
    cmd += " -%s '%s'"% (item[1], self.quote_for_run(self.options["--" + item[1]]))
KeyError: '--a'

Expected results:
/usr/bin/snmpget -m '' -Oeqn  -v '3' -a 'SHA' -l 'auth' -A '87654321' -u 'snmpv3user' '85.17.234.138:161' '.1.3.6.1.4.1.343.2.19.1.2.10.202.1.1.6.3'
.1.3.6.1.4.1.343.2.19.1.2.10.202.1.1.6.3 2

Status: ON


Additional info:
I have found the bug, but can't know if it will affect other snmp fencing. But the correction is logic trough my eyes

in the file fencing_snmp.py on line 73 it states:
cmd += " -%s '%s'"% (item[1], self.quote_for_run(self.options["--" + item[1]]))

And it need to be:
cmd += " -%s '%s'"% (item[1], self.quote_for_run(self.options["--" + item[0]]))
I have attached the corrected file
Comment 1 Tim Schoondergang 2013-08-20 15:47:27 EDT
Created attachment 788626 [details]
corrected file

This the corrected file.
Comment 3 Marek Grac 2013-08-28 04:17:21 EDT
Thanks for reporting, fix is in upstream now. But are you sure that this happends in RHEL 6.x ? Should it be reported against upstream?
Comment 4 Tim Schoondergang 2013-08-28 04:43:27 EDT
Hi Marec,

No you are totaly right. It was Fedora. I was confused and mixed my RHE servers with my test servers. Sorry, my excuse!

How did I need to report it? So I can't make this mistake again.
Comment 5 Marek Grac 2013-08-28 04:46:26 EDT
@Tim:

No problem, I'm also upstream and Fedora maintainer so I have to do it anyway. Next time, just report it against Fedora.

Note You need to log in before you can comment on or make changes to this bug.