1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-05-03 08:52:55 +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

@ -85,27 +85,27 @@ from ansible_collections.community.general.plugins.module_utils.heroku import He
def add_or_delete_heroku_collaborator(module, client):
user = module.params['user']
state = module.params['state']
user = module.params["user"]
state = module.params["state"]
affected_apps = []
result_state = False
for app in module.params['apps']:
for app in module.params["apps"]:
if app not in client.apps():
module.fail_json(msg=f'App {app} does not exist')
module.fail_json(msg=f"App {app} does not exist")
heroku_app = client.apps()[app]
heroku_collaborator_list = [collaborator.user.email for collaborator in heroku_app.collaborators()]
if state == 'absent' and user in heroku_collaborator_list:
if state == "absent" and user in heroku_collaborator_list:
if not module.check_mode:
heroku_app.remove_collaborator(user)
affected_apps += [app]
result_state = True
elif state == 'present' and user not in heroku_collaborator_list:
elif state == "present" and user not in heroku_collaborator_list:
if not module.check_mode:
heroku_app.add_collaborator(user_id_or_email=user, silent=module.params['suppress_invitation'])
heroku_app.add_collaborator(user_id_or_email=user, silent=module.params["suppress_invitation"])
affected_apps += [app]
result_state = True
@ -115,15 +115,12 @@ def add_or_delete_heroku_collaborator(module, client):
def main():
argument_spec = HerokuHelper.heroku_argument_spec()
argument_spec.update(
user=dict(required=True, type='str'),
apps=dict(required=True, type='list', elements='str'),
suppress_invitation=dict(default=False, type='bool'),
state=dict(default='present', type='str', choices=['present', 'absent']),
)
module = AnsibleModule(
argument_spec=argument_spec,
supports_check_mode=True
user=dict(required=True, type="str"),
apps=dict(required=True, type="list", elements="str"),
suppress_invitation=dict(default=False, type="bool"),
state=dict(default="present", type="str", choices=["present", "absent"]),
)
module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
client = HerokuHelper(module).get_heroku_client()
@ -131,5 +128,5 @@ def main():
module.exit_json(changed=has_changed, msg=msg)
if __name__ == '__main__':
if __name__ == "__main__":
main()