1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-18 18:01:31 +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

@ -119,10 +119,10 @@ from ansible.module_utils.basic import AnsibleModule
def get_bundler_executable(module):
if module.params.get('executable'):
result = module.params.get('executable').split(' ')
if module.params.get("executable"):
result = module.params.get("executable").split(" ")
else:
result = [module.get_bin_path('bundle', True)]
result = [module.get_bin_path("bundle", True)]
return result
@ -130,71 +130,71 @@ def main():
module = AnsibleModule(
argument_spec=dict(
executable=dict(),
state=dict(default='present', choices=['present', 'latest']),
chdir=dict(type='path'),
exclude_groups=dict(type='list', elements='str'),
clean=dict(default=False, type='bool'),
gemfile=dict(type='path'),
local=dict(default=False, type='bool'),
deployment_mode=dict(default=False, type='bool'),
user_install=dict(default=True, type='bool'),
gem_path=dict(type='path'),
binstub_directory=dict(type='path'),
state=dict(default="present", choices=["present", "latest"]),
chdir=dict(type="path"),
exclude_groups=dict(type="list", elements="str"),
clean=dict(default=False, type="bool"),
gemfile=dict(type="path"),
local=dict(default=False, type="bool"),
deployment_mode=dict(default=False, type="bool"),
user_install=dict(default=True, type="bool"),
gem_path=dict(type="path"),
binstub_directory=dict(type="path"),
extra_args=dict(),
),
supports_check_mode=True
supports_check_mode=True,
)
state = module.params.get('state')
chdir = module.params.get('chdir')
exclude_groups = module.params.get('exclude_groups')
clean = module.params.get('clean')
gemfile = module.params.get('gemfile')
local = module.params.get('local')
deployment_mode = module.params.get('deployment_mode')
user_install = module.params.get('user_install')
gem_path = module.params.get('gem_path')
binstub_directory = module.params.get('binstub_directory')
extra_args = module.params.get('extra_args')
state = module.params.get("state")
chdir = module.params.get("chdir")
exclude_groups = module.params.get("exclude_groups")
clean = module.params.get("clean")
gemfile = module.params.get("gemfile")
local = module.params.get("local")
deployment_mode = module.params.get("deployment_mode")
user_install = module.params.get("user_install")
gem_path = module.params.get("gem_path")
binstub_directory = module.params.get("binstub_directory")
extra_args = module.params.get("extra_args")
cmd = get_bundler_executable(module)
if module.check_mode:
cmd.append('check')
cmd.append("check")
rc, out, err = module.run_command(cmd, cwd=chdir, check_rc=False)
module.exit_json(changed=rc != 0, state=state, stdout=out, stderr=err)
if state == 'present':
cmd.append('install')
if state == "present":
cmd.append("install")
if exclude_groups:
cmd.extend(['--without', ':'.join(exclude_groups)])
cmd.extend(["--without", ":".join(exclude_groups)])
if clean:
cmd.append('--clean')
cmd.append("--clean")
if gemfile:
cmd.extend(['--gemfile', gemfile])
cmd.extend(["--gemfile", gemfile])
if local:
cmd.append('--local')
cmd.append("--local")
if deployment_mode:
cmd.append('--deployment')
cmd.append("--deployment")
if not user_install:
cmd.append('--system')
cmd.append("--system")
if gem_path:
cmd.extend(['--path', gem_path])
cmd.extend(["--path", gem_path])
if binstub_directory:
cmd.extend(['--binstubs', binstub_directory])
cmd.extend(["--binstubs", binstub_directory])
else:
cmd.append('update')
cmd.append("update")
if local:
cmd.append('--local')
cmd.append("--local")
if extra_args:
cmd.extend(extra_args.split(' '))
cmd.extend(extra_args.split(" "))
rc, out, err = module.run_command(cmd, cwd=chdir, check_rc=True)
module.exit_json(changed='Installing' in out, state=state, stdout=out, stderr=err)
module.exit_json(changed="Installing" in out, state=state, stdout=out, stderr=err)
if __name__ == '__main__':
if __name__ == "__main__":
main()