1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-08 13:07:19 +00:00

Reformat everything.

This commit is contained in:
Felix Fontein 2025-11-01 12:08:41 +01:00
parent 3f2213791a
commit 340ff8586d
1008 changed files with 61301 additions and 58309 deletions

View file

@ -94,45 +94,42 @@ else:
def run_module():
module_args = dict(
msg_plain=dict(type='str', required=True),
msg_html=dict(type='str', required=True),
room_id=dict(type='str', required=True),
hs_url=dict(type='str', required=True),
token=dict(type='str', no_log=True),
user_id=dict(type='str'),
password=dict(type='str', no_log=True),
msg_plain=dict(type="str", required=True),
msg_html=dict(type="str", required=True),
room_id=dict(type="str", required=True),
hs_url=dict(type="str", required=True),
token=dict(type="str", no_log=True),
user_id=dict(type="str"),
password=dict(type="str", no_log=True),
)
result = dict(
changed=False,
message=''
)
result = dict(changed=False, message="")
module = AnsibleModule(
argument_spec=module_args,
mutually_exclusive=[['password', 'token']],
required_one_of=[['password', 'token']],
required_together=[['user_id', 'password']],
supports_check_mode=True
mutually_exclusive=[["password", "token"]],
required_one_of=[["password", "token"]],
required_together=[["user_id", "password"]],
supports_check_mode=True,
)
if not matrix_found:
module.fail_json(msg=missing_required_lib('matrix-client'), exception=MATRIX_IMP_ERR)
module.fail_json(msg=missing_required_lib("matrix-client"), exception=MATRIX_IMP_ERR)
if module.check_mode:
return result
# create a client object
client = MatrixClient(module.params['hs_url'])
if module.params['token'] is not None:
client.api.token = module.params['token']
client = MatrixClient(module.params["hs_url"])
if module.params["token"] is not None:
client.api.token = module.params["token"]
else:
client.login(module.params['user_id'], module.params['password'], sync=False)
client.login(module.params["user_id"], module.params["password"], sync=False)
# make sure we are in a given room and return a room object for it
room = client.join_room(module.params['room_id'])
room = client.join_room(module.params["room_id"])
# send an html formatted messages
room.send_html(module.params['msg_html'], module.params['msg_plain'])
room.send_html(module.params["msg_html"], module.params["msg_plain"])
module.exit_json(**result)
@ -141,5 +138,5 @@ def main():
run_module()
if __name__ == '__main__':
if __name__ == "__main__":
main()