mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-19 17:01:25 -07:00
[PR #6848/11406715 backport][stable-7] npm: replace test with required_if (#6856)
npm: replace test with required_if (#6848)
* npm: replace test with required_if
* add changelog frag
(cherry picked from commit 11406715f5
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
1c8fbed36c
commit
42cc5280d9
3 changed files with 6 additions and 14 deletions
|
@ -285,7 +285,8 @@ def main():
|
|||
arg_spec['global'] = dict(default=False, type='bool')
|
||||
module = AnsibleModule(
|
||||
argument_spec=arg_spec,
|
||||
supports_check_mode=True
|
||||
required_if=[('state', 'absent', ['name'])],
|
||||
supports_check_mode=True,
|
||||
)
|
||||
|
||||
name = module.params['name']
|
||||
|
@ -304,8 +305,6 @@ def main():
|
|||
|
||||
if not path and not glbl:
|
||||
module.fail_json(msg='path must be specified when not using global')
|
||||
if state == 'absent' and not name:
|
||||
module.fail_json(msg='uninstalling a package is only available for named packages')
|
||||
|
||||
npm = Npm(module, name=name, path=path, version=version, glbl=glbl, production=production,
|
||||
executable=executable, registry=registry, ignore_scripts=ignore_scripts,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue