mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
PEP8 fixes: Ansible system module and playbook base.py (#32322)
* Ansible files module sanity pep8 fixes * Ansible system module and playbook base.py * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Undo empty lines not required by sanity checks * Various changes * Various changes * Various changes * Various changes * Undo blank lines not required by sanity checks * Various changes * Various changes * Various changes * Various changes * Various changes * Undo blank line changes not required by sanity checks * Various changes * Various changes * Various changes * Various changes * Various changes * Missing piece after merge * Blank lines * Blank line * Line too long * Fix typo * Unnecessary quotes * Fix example error
This commit is contained in:
committed by
Dag Wieers
parent
a5da2e44a1
commit
a2d34e914e
@@ -5,14 +5,13 @@
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
ANSIBLE_METADATA = {'metadata_version': '1.1',
|
||||
'status': ['preview'],
|
||||
'supported_by': 'community'}
|
||||
|
||||
|
||||
DOCUMENTATION = '''
|
||||
---
|
||||
module: open_iscsi
|
||||
@@ -113,19 +112,16 @@ import time
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
|
||||
|
||||
ISCSIADM = 'iscsiadm'
|
||||
|
||||
|
||||
def compare_nodelists(l1, l2):
|
||||
|
||||
l1.sort()
|
||||
l2.sort()
|
||||
return l1 == l2
|
||||
|
||||
|
||||
def iscsi_get_cached_nodes(module, portal=None):
|
||||
|
||||
cmd = '%s --mode node' % iscsiadm_cmd
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -156,7 +152,6 @@ def iscsi_get_cached_nodes(module, portal=None):
|
||||
|
||||
|
||||
def iscsi_discover(module, portal, port):
|
||||
|
||||
cmd = '%s --mode discovery --type sendtargets --portal %s:%s' % (iscsiadm_cmd, portal, port)
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -165,7 +160,6 @@ def iscsi_discover(module, portal, port):
|
||||
|
||||
|
||||
def target_loggedon(module, target):
|
||||
|
||||
cmd = '%s --mode session' % iscsiadm_cmd
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -178,7 +172,6 @@ def target_loggedon(module, target):
|
||||
|
||||
|
||||
def target_login(module, target):
|
||||
|
||||
node_auth = module.params['node_auth']
|
||||
node_user = module.params['node_user']
|
||||
node_pass = module.params['node_pass']
|
||||
@@ -201,7 +194,6 @@ def target_login(module, target):
|
||||
|
||||
|
||||
def target_logout(module, target):
|
||||
|
||||
cmd = '%s --mode node --targetname %s --logout' % (iscsiadm_cmd, target)
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -210,7 +202,6 @@ def target_logout(module, target):
|
||||
|
||||
|
||||
def target_device_node(module, target):
|
||||
|
||||
# if anyone know a better way to find out which devicenodes get created for
|
||||
# a given target...
|
||||
|
||||
@@ -227,7 +218,6 @@ def target_device_node(module, target):
|
||||
|
||||
|
||||
def target_isauto(module, target):
|
||||
|
||||
cmd = '%s --mode node --targetname %s' % (iscsiadm_cmd, target)
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -242,7 +232,6 @@ def target_isauto(module, target):
|
||||
|
||||
|
||||
def target_setauto(module, target):
|
||||
|
||||
cmd = '%s --mode node --targetname %s --op=update --name node.startup --value automatic' % (iscsiadm_cmd, target)
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -251,7 +240,6 @@ def target_setauto(module, target):
|
||||
|
||||
|
||||
def target_setmanual(module, target):
|
||||
|
||||
cmd = '%s --mode node --targetname %s --op=update --name node.startup --value manual' % (iscsiadm_cmd, target)
|
||||
(rc, out, err) = module.run_command(cmd)
|
||||
|
||||
@@ -260,24 +248,23 @@ def target_setmanual(module, target):
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
# load ansible module object
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
argument_spec=dict(
|
||||
|
||||
# target
|
||||
portal = dict(required=False, aliases=['ip']),
|
||||
port = dict(required=False, default=3260),
|
||||
target = dict(required=False, aliases=['name', 'targetname']),
|
||||
node_auth = dict(required=False, default='CHAP'),
|
||||
node_user = dict(required=False),
|
||||
node_pass = dict(required=False, no_log=True),
|
||||
portal=dict(required=False, aliases=['ip']),
|
||||
port=dict(required=False, default=3260),
|
||||
target=dict(required=False, aliases=['name', 'targetname']),
|
||||
node_auth=dict(required=False, default='CHAP'),
|
||||
node_user=dict(required=False),
|
||||
node_pass=dict(required=False, no_log=True),
|
||||
|
||||
# actions
|
||||
login = dict(type='bool', aliases=['state']),
|
||||
auto_node_startup = dict(type='bool', aliases=['automatic']),
|
||||
discover = dict(type='bool', default=False),
|
||||
show_nodes = dict(type='bool', default=False)
|
||||
login=dict(type='bool', aliases=['state']),
|
||||
auto_node_startup=dict(type='bool', aliases=['automatic']),
|
||||
discover=dict(type='bool', default=False),
|
||||
show_nodes=dict(type='bool', default=False)
|
||||
),
|
||||
|
||||
required_together=[['discover_user', 'discover_pass'],
|
||||
@@ -307,7 +294,7 @@ def main():
|
||||
|
||||
if discover:
|
||||
if portal is None:
|
||||
module.fail_json(msg = "Need to specify at least the portal (ip) to discover")
|
||||
module.fail_json(msg="Need to specify at least the portal (ip) to discover")
|
||||
elif check:
|
||||
nodes = cached
|
||||
else:
|
||||
@@ -322,7 +309,7 @@ def main():
|
||||
if login is not None or automatic is not None:
|
||||
if target is None:
|
||||
if len(nodes) > 1:
|
||||
module.fail_json(msg = "Need to specify a target")
|
||||
module.fail_json(msg="Need to specify a target")
|
||||
else:
|
||||
target = nodes[0]
|
||||
else:
|
||||
@@ -333,7 +320,7 @@ def main():
|
||||
check_target = True
|
||||
break
|
||||
if not check_target:
|
||||
module.fail_json(msg = "Specified target not found")
|
||||
module.fail_json(msg="Specified target not found")
|
||||
|
||||
if show_nodes:
|
||||
result['nodes'] = nodes
|
||||
|
||||
Reference in New Issue
Block a user