mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02: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
@@ -80,8 +80,8 @@ def chain(module):
|
||||
controller = module.params['controller']
|
||||
|
||||
rest = Rest(module,
|
||||
{'content-type': 'application/json', 'Cookie': 'session_cookie='+access_token},
|
||||
'https://'+controller+':8443/api/v1/data/controller/applications/bigchain')
|
||||
{'content-type': 'application/json', 'Cookie': 'session_cookie=' + access_token},
|
||||
'https://' + controller + ':8443/api/v1/data/controller/applications/bigchain')
|
||||
|
||||
if None in (name, state, controller):
|
||||
module.fail_json(msg='parameter `name` is missing')
|
||||
@@ -115,6 +115,7 @@ def chain(module):
|
||||
else:
|
||||
module.fail_json(msg="error deleting chain '{}': {}".format(name, response.json['description']))
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
|
||||
@@ -113,8 +113,8 @@ def policy(module):
|
||||
controller = module.params['controller']
|
||||
|
||||
rest = Rest(module,
|
||||
{'content-type': 'application/json', 'Cookie': 'session_cookie='+access_token},
|
||||
'https://'+controller+':8443/api/v1/data/controller/applications/bigtap')
|
||||
{'content-type': 'application/json', 'Cookie': 'session_cookie=' + access_token},
|
||||
'https://' + controller + ':8443/api/v1/data/controller/applications/bigtap')
|
||||
|
||||
if name is None:
|
||||
module.fail_json(msg='parameter `name` is missing')
|
||||
@@ -127,11 +127,11 @@ def policy(module):
|
||||
|
||||
matching = [policy for policy in response.json
|
||||
if policy['name'] == name and
|
||||
policy['duration'] == duration and
|
||||
policy['delivery-packet-count'] == delivery_packet_count and
|
||||
policy['policy-description'] == policy_description and
|
||||
policy['action'] == action and
|
||||
policy['priority'] == priority]
|
||||
policy['duration'] == duration and
|
||||
policy['delivery-packet-count'] == delivery_packet_count and
|
||||
policy['policy-description'] == policy_description and
|
||||
policy['action'] == action and
|
||||
policy['priority'] == priority]
|
||||
|
||||
if matching:
|
||||
config_present = True
|
||||
@@ -143,9 +143,9 @@ def policy(module):
|
||||
module.exit_json(changed=False)
|
||||
|
||||
if state in ('present'):
|
||||
data={'name': name, 'action': action, 'policy-description': policy_description,
|
||||
'priority': priority, 'duration': duration, 'start-time': start_time,
|
||||
'delivery-packet-count': delivery_packet_count }
|
||||
data = {'name': name, 'action': action, 'policy-description': policy_description,
|
||||
'priority': priority, 'duration': duration, 'start-time': start_time,
|
||||
'delivery-packet-count': delivery_packet_count}
|
||||
|
||||
response = rest.put('policy[name="%s"]' % name, data=data)
|
||||
if response.status_code == 204:
|
||||
@@ -160,6 +160,7 @@ def policy(module):
|
||||
else:
|
||||
module.fail_json(msg="error deleting policy '{}': {}".format(name, response.json['description']))
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
@@ -168,7 +169,7 @@ def main():
|
||||
action=dict(choices=['forward', 'drop', 'capture', 'flow-gen'], default='forward'),
|
||||
priority=dict(type='int', default=100),
|
||||
duration=dict(type='int', default=0),
|
||||
start_time=dict(type='str', default=datetime.datetime.now().isoformat()+'+00:00'),
|
||||
start_time=dict(type='str', default=datetime.datetime.now().isoformat() + '+00:00'),
|
||||
delivery_packet_count=dict(type='int', default=0),
|
||||
controller=dict(type='str', required=True),
|
||||
state=dict(choices=['present', 'absent'], default='present'),
|
||||
|
||||
Reference in New Issue
Block a user