Bug 1384073

Summary: ConnectionError exception is not imported correctly in fence_compute agent
Product: Red Hat Enterprise Linux 7 Reporter: Marian Krcmarik <mkrcmari>
Component: fence-agentsAssignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: cluster-qe <cluster-qe>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: cluster-maint, fdinitto, mjuricek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: fence-agents-4.0.11-52.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 16:10:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Marian Krcmarik 2016-10-12 13:24:44 UTC
Description of problem:
If a condition for raising the exception is met, I am getting traceback:
[ Traceback (most recent call last): ]
[   File "/usr/sbin/fence_compute", line 438, in <module> ]
[     main() ]
[   File "/usr/sbin/fence_compute", line 434, in main ]
[     result = fence_action(None, options, set_power_status, get_power_status, get_plugs_list,
 None) ]
   File "/usr/share/fence/fencing.py", line 973, in fence_action ]
[     status = get_multi_power_fn(tn, options, get_power_fn) ]
[   File "/usr/share/fence/fencing.py", line 880, in get_multi_power_fn ]
     plug_status = get_power_fn(tn, options) ]
[   File "/usr/sbin/fence_compute", line 48, in get_power_status ]
[     except ConnectionError as (err): ]
[ NameError: global name 'ConnectionError' is not defined ]

So either import should be edited as:
from requests.exceptions import ConnectionError or catching exception as
requests.exception.ConnectionError

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

How reproducible:
fence-agents-compute-4.0.11-47.el7.x86_64

Steps to Reproduce:
1. Set up a pck resource which uses fence-compute and use parameters for fence_compute that it's not possible to get conenction to nova API.

Actual results:
NameError: global name 'ConnectionError' is not defined

Expected results:
Logging an error.

Additional info:

Comment 2 Oyvind Albrigtsen 2016-10-17 11:06:25 UTC
https://github.com/ClusterLabs/fence-agents/pull/88

Comment 5 errata-xmlrpc 2017-08-01 16:10:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1874