Skip to content

Commit

Permalink
Fix pylint errors in the hds array driver
Browse files Browse the repository at this point in the history
************* Module rcHds
lib/rcHds.py:528:12: E1111: Assigning to function call which doesn't return (assignment-from-no-return)

=> Add an explicit "return" to _del_map(), even if never pushed to "results"

lib/rcHds.py:709:11: E1101: Instance of 'Array' has no 'node' member (no-member)
lib/rcHds.py:712:18: E1101: Instance of 'Array' has no 'node' member (no-member)
lib/rcHds.py:720:11: E1101: Instance of 'Array' has no 'node' member (no-member)
lib/rcHds.py:723:18: E1101: Instance of 'Array' has no 'node' member (no-member)

=> initialize Array::node to None, even if the property is never used before set

lib/rcHds.py:761:8: E1111: Assigning to function call which doesn't return (assignment-from-no-return)

=> propagate the do_action return code up to main() return exit point
  • Loading branch information
cvaroqui committed Oct 3, 2018
1 parent ea3fe63 commit 3f792b2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/rcHds.py
Expand Up @@ -184,6 +184,7 @@ def get_array(self, name):

class Array(object):
def __init__(self, name, url, username, password, bin=None):
self.node = None
self.keys = ['array', 'lu', 'arraygroup', 'port', 'pool']
self.name = name
self.model = name.split(".")[0]
Expand Down Expand Up @@ -548,6 +549,7 @@ def _del_map(self, devnum=None, domain=None, portname=None, **kwargs):
out, err, ret = self.cmd(cmd, xml=False, log=True)
if ret != 0:
raise ex.excError(err)
return

def add_map(self, devnum=None, mappings=None, lun=None, **kwargs):
if devnum is None:
Expand Down Expand Up @@ -747,14 +749,15 @@ def do_action(action, array_name=None, node=None, **kwargs):
ret = getattr(array, action)(**kwargs)
if ret is not None:
print(json.dumps(ret, indent=4))
return ret

def main(argv, node=None):
parser = OptParser(prog=PROG, options=OPT, actions=ACTIONS,
deprecated_actions=DEPRECATED_ACTIONS,
global_options=GLOBAL_OPTS)
options, action = parser.parse_args(argv)
kwargs = vars(options)
do_action(action, node=node, **kwargs)
return do_action(action, node=node, **kwargs)

if __name__ == "__main__":
try:
Expand Down

0 comments on commit 3f792b2

Please sign in to comment.