mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Bulk autopep8 (modules)
As agreed in 2017-12-07 Core meeting bulk fix pep8 issues Generated using: autopep8 1.3.3 (pycodestyle: 2.3.1) autopep8 -r --max-line-length 160 --in-place --ignore E305,E402,E722,E741 lib/ansible/modules Manually fix issues that autopep8 has introduced
This commit is contained in:
committed by
John R Barker
parent
d13d7e9404
commit
c57a7f05e1
@@ -147,9 +147,11 @@ def parse_plugin_repo(string):
|
||||
|
||||
return repo
|
||||
|
||||
|
||||
def is_plugin_present(plugin_dir, working_dir):
|
||||
return os.path.isdir(os.path.join(working_dir, plugin_dir))
|
||||
|
||||
|
||||
def parse_error(string):
|
||||
reason = "reason: "
|
||||
try:
|
||||
@@ -157,6 +159,7 @@ def parse_error(string):
|
||||
except ValueError:
|
||||
return string
|
||||
|
||||
|
||||
def install_plugin(module, plugin_bin, plugin_name, url, timeout):
|
||||
cmd_args = [plugin_bin, "plugin", PACKAGE_STATE_MAP["present"], plugin_name]
|
||||
|
||||
@@ -178,6 +181,7 @@ def install_plugin(module, plugin_bin, plugin_name, url, timeout):
|
||||
|
||||
return True, cmd, out, err
|
||||
|
||||
|
||||
def remove_plugin(module, plugin_bin, plugin_name):
|
||||
cmd_args = [plugin_bin, "plugin", PACKAGE_STATE_MAP["absent"], plugin_name]
|
||||
|
||||
@@ -193,6 +197,7 @@ def remove_plugin(module, plugin_bin, plugin_name):
|
||||
|
||||
return True, cmd, out, err
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
@@ -208,14 +213,14 @@ def main():
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
name = module.params["name"]
|
||||
state = module.params["state"]
|
||||
url = module.params["url"]
|
||||
timeout = module.params["timeout"]
|
||||
plugin_bin = module.params["plugin_bin"]
|
||||
plugin_dir = module.params["plugin_dir"]
|
||||
version = module.params["version"]
|
||||
force = module.params["force"]
|
||||
name = module.params["name"]
|
||||
state = module.params["state"]
|
||||
url = module.params["url"]
|
||||
timeout = module.params["timeout"]
|
||||
plugin_bin = module.params["plugin_bin"]
|
||||
plugin_dir = module.params["plugin_dir"]
|
||||
version = module.params["version"]
|
||||
force = module.params["force"]
|
||||
|
||||
present = is_plugin_present(parse_plugin_repo(name), plugin_dir)
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ def ring_check(module, riak_admin_bin):
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
module = AnsibleModule(
|
||||
@@ -115,10 +116,9 @@ def main():
|
||||
wait_for_ring=dict(default=False, type='int'),
|
||||
wait_for_service=dict(
|
||||
required=False, default=None, choices=['kv']),
|
||||
validate_certs = dict(default='yes', type='bool'))
|
||||
validate_certs=dict(default='yes', type='bool'))
|
||||
)
|
||||
|
||||
|
||||
command = module.params.get('command')
|
||||
http_conn = module.params.get('http_conn')
|
||||
target_node = module.params.get('target_node')
|
||||
@@ -126,8 +126,7 @@ def main():
|
||||
wait_for_ring = module.params.get('wait_for_ring')
|
||||
wait_for_service = module.params.get('wait_for_service')
|
||||
|
||||
|
||||
#make sure riak commands are on the path
|
||||
# make sure riak commands are on the path
|
||||
riak_bin = module.get_bin_path('riak')
|
||||
riak_admin_bin = module.get_bin_path('riak-admin')
|
||||
|
||||
@@ -150,16 +149,16 @@ def main():
|
||||
node_name = stats['nodename']
|
||||
nodes = stats['ring_members']
|
||||
ring_size = stats['ring_creation_size']
|
||||
rc, out, err = module.run_command([riak_bin, 'version'] )
|
||||
rc, out, err = module.run_command([riak_bin, 'version'])
|
||||
version = out.strip()
|
||||
|
||||
result = dict(node_name=node_name,
|
||||
nodes=nodes,
|
||||
ring_size=ring_size,
|
||||
version=version)
|
||||
nodes=nodes,
|
||||
ring_size=ring_size,
|
||||
version=version)
|
||||
|
||||
if command == 'ping':
|
||||
cmd = '%s ping %s' % ( riak_bin, target_node )
|
||||
cmd = '%s ping %s' % (riak_bin, target_node)
|
||||
rc, out, err = module.run_command(cmd)
|
||||
if rc == 0:
|
||||
result['ping'] = out
|
||||
@@ -219,7 +218,7 @@ def main():
|
||||
module.fail_json(msg='Timeout waiting for handoffs.')
|
||||
|
||||
if wait_for_service:
|
||||
cmd = [riak_admin_bin, 'wait_for_service', 'riak_%s' % wait_for_service, node_name ]
|
||||
cmd = [riak_admin_bin, 'wait_for_service', 'riak_%s' % wait_for_service, node_name]
|
||||
rc, out, err = module.run_command(cmd)
|
||||
result['service'] = out
|
||||
|
||||
|
||||
Reference in New Issue
Block a user