mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +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
@@ -189,7 +189,7 @@ escape_table = {
|
||||
|
||||
def escape_quotes(text):
|
||||
'''Backslash any quotes within text.'''
|
||||
return "".join(escape_table.get(c,c) for c in text)
|
||||
return "".join(escape_table.get(c, c) for c in text)
|
||||
|
||||
|
||||
def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoji, link_names, parse, color, attachments):
|
||||
@@ -203,7 +203,7 @@ def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoj
|
||||
if (channel[0] == '#') or (channel[0] == '@'):
|
||||
payload['channel'] = channel
|
||||
else:
|
||||
payload['channel'] = '#'+channel
|
||||
payload['channel'] = '#' + channel
|
||||
if username is not None:
|
||||
payload['username'] = username
|
||||
if icon_emoji is not None:
|
||||
@@ -237,9 +237,10 @@ def build_payload_for_slack(module, text, channel, username, icon_url, icon_emoj
|
||||
|
||||
payload['attachments'].append(attachment)
|
||||
|
||||
payload=module.jsonify(payload)
|
||||
payload = module.jsonify(payload)
|
||||
return payload
|
||||
|
||||
|
||||
def do_notify_slack(module, domain, token, payload):
|
||||
if token.count('/') >= 2:
|
||||
# New style token
|
||||
@@ -259,21 +260,22 @@ def do_notify_slack(module, domain, token, payload):
|
||||
obscured_incoming_webhook = SLACK_INCOMING_WEBHOOK % ('[obscured]')
|
||||
module.fail_json(msg=" failed to send %s to %s: %s" % (payload, obscured_incoming_webhook, info['msg']))
|
||||
|
||||
|
||||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec = dict(
|
||||
domain = dict(type='str', required=False, default=None),
|
||||
token = dict(type='str', required=True, no_log=True),
|
||||
msg = dict(type='str', required=False, default=None),
|
||||
channel = dict(type='str', default=None),
|
||||
username = dict(type='str', default='Ansible'),
|
||||
icon_url = dict(type='str', default='https://www.ansible.com/favicon.ico'),
|
||||
icon_emoji = dict(type='str', default=None),
|
||||
link_names = dict(type='int', default=1, choices=[0,1]),
|
||||
parse = dict(type='str', default=None, choices=['none', 'full']),
|
||||
validate_certs = dict(default='yes', type='bool'),
|
||||
color = dict(type='str', default='normal', choices=['normal', 'good', 'warning', 'danger']),
|
||||
attachments = dict(type='list', required=False, default=None)
|
||||
argument_spec=dict(
|
||||
domain=dict(type='str', required=False, default=None),
|
||||
token=dict(type='str', required=True, no_log=True),
|
||||
msg=dict(type='str', required=False, default=None),
|
||||
channel=dict(type='str', default=None),
|
||||
username=dict(type='str', default='Ansible'),
|
||||
icon_url=dict(type='str', default='https://www.ansible.com/favicon.ico'),
|
||||
icon_emoji=dict(type='str', default=None),
|
||||
link_names=dict(type='int', default=1, choices=[0, 1]),
|
||||
parse=dict(type='str', default=None, choices=['none', 'full']),
|
||||
validate_certs=dict(default='yes', type='bool'),
|
||||
color=dict(type='str', default='normal', choices=['normal', 'good', 'warning', 'danger']),
|
||||
attachments=dict(type='list', required=False, default=None)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user