mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-20 18:59:08 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -70,7 +70,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||
from ansible.module_utils.urls import fetch_url
|
||||
|
||||
|
||||
BASE_URL = 'https://grove.io/api/notice/%s/'
|
||||
BASE_URL = "https://grove.io/api/notice/%s/"
|
||||
|
||||
# ==============================================================
|
||||
# do_notify_grove
|
||||
|
|
@ -81,15 +81,16 @@ def do_notify_grove(module, channel_token, service, message, url=None, icon_url=
|
|||
|
||||
my_data = dict(service=service, message=message)
|
||||
if url is not None:
|
||||
my_data['url'] = url
|
||||
my_data["url"] = url
|
||||
if icon_url is not None:
|
||||
my_data['icon_url'] = icon_url
|
||||
my_data["icon_url"] = icon_url
|
||||
|
||||
data = urlencode(my_data)
|
||||
response, info = fetch_url(module, my_url, data=data)
|
||||
if info['status'] != 200:
|
||||
if info["status"] != 200:
|
||||
module.fail_json(msg=f"failed to send notification: {info['msg']}")
|
||||
|
||||
|
||||
# ==============================================================
|
||||
# main
|
||||
|
||||
|
|
@ -97,20 +98,20 @@ def do_notify_grove(module, channel_token, service, message, url=None, icon_url=
|
|||
def main():
|
||||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
channel_token=dict(type='str', required=True, no_log=True),
|
||||
message_content=dict(type='str', required=True),
|
||||
service=dict(type='str', default='ansible'),
|
||||
url=dict(type='str'),
|
||||
icon_url=dict(type='str'),
|
||||
validate_certs=dict(default=True, type='bool'),
|
||||
channel_token=dict(type="str", required=True, no_log=True),
|
||||
message_content=dict(type="str", required=True),
|
||||
service=dict(type="str", default="ansible"),
|
||||
url=dict(type="str"),
|
||||
icon_url=dict(type="str"),
|
||||
validate_certs=dict(default=True, type="bool"),
|
||||
)
|
||||
)
|
||||
|
||||
channel_token = module.params['channel_token']
|
||||
service = module.params['service']
|
||||
message = module.params['message_content']
|
||||
url = module.params['url']
|
||||
icon_url = module.params['icon_url']
|
||||
channel_token = module.params["channel_token"]
|
||||
service = module.params["service"]
|
||||
message = module.params["message_content"]
|
||||
url = module.params["url"]
|
||||
icon_url = module.params["icon_url"]
|
||||
|
||||
do_notify_grove(module, channel_token, service, message, url, icon_url)
|
||||
|
||||
|
|
@ -118,5 +119,5 @@ def main():
|
|||
module.exit_json(msg="OK")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue