no-suggests is obsolete, switch to no-recommends
This commit is contained in:
parent
2b860bbae8
commit
9ab42a98ca
1 changed files with 15 additions and 15 deletions
|
@ -44,9 +44,9 @@ options:
|
||||||
required: false
|
required: false
|
||||||
default: no
|
default: no
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
no-suggests:
|
no-recommends:
|
||||||
description:
|
description:
|
||||||
- Corresponds to the C(--no-suggests) option for I(urpmi).
|
- Corresponds to the C(--no-recommends) option for I(urpmi).
|
||||||
required: false
|
required: false
|
||||||
default: yes
|
default: yes
|
||||||
choices: [ "yes", "no" ]
|
choices: [ "yes", "no" ]
|
||||||
|
@ -130,7 +130,7 @@ def remove_packages(module, packages):
|
||||||
module.exit_json(changed=False, msg="package(s) already absent")
|
module.exit_json(changed=False, msg="package(s) already absent")
|
||||||
|
|
||||||
|
|
||||||
def install_packages(module, pkgspec, force=True, no_suggests=True):
|
def install_packages(module, pkgspec, force=True, no_recommends=True):
|
||||||
|
|
||||||
packages = ""
|
packages = ""
|
||||||
for package in pkgspec:
|
for package in pkgspec:
|
||||||
|
@ -138,17 +138,17 @@ def install_packages(module, pkgspec, force=True, no_suggests=True):
|
||||||
packages += "'%s' " % package
|
packages += "'%s' " % package
|
||||||
|
|
||||||
if len(packages) != 0:
|
if len(packages) != 0:
|
||||||
if no_suggests:
|
if no_recommends:
|
||||||
no_suggests_yes = '--no-suggests'
|
no_recommends_yes = '--no-recommends'
|
||||||
else:
|
else:
|
||||||
no_suggests_yes = ''
|
no_recommends_yes = ''
|
||||||
|
|
||||||
if force:
|
if force:
|
||||||
force_yes = '--force'
|
force_yes = '--force'
|
||||||
else:
|
else:
|
||||||
force_yes = ''
|
force_yes = ''
|
||||||
|
|
||||||
cmd = ("%s --auto %s --quiet %s %s" % (URPMI_PATH, force_yes, no_suggests_yes, packages))
|
cmd = ("%s --auto %s --quiet %s %s" % (URPMI_PATH, force_yes, no_recommends_yes, packages))
|
||||||
|
|
||||||
rc, out, err = module.run_command(cmd)
|
rc, out, err = module.run_command(cmd)
|
||||||
|
|
||||||
|
@ -168,12 +168,12 @@ def install_packages(module, pkgspec, force=True, no_suggests=True):
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec = dict(
|
argument_spec = dict(
|
||||||
state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']),
|
state = dict(default='installed', choices=['installed', 'removed', 'absent', 'present']),
|
||||||
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
|
update_cache = dict(default=False, aliases=['update-cache'], type='bool'),
|
||||||
force = dict(default=True, type='bool'),
|
force = dict(default=True, type='bool'),
|
||||||
no_suggests = dict(default=True, aliases=['no-suggests'], type='bool'),
|
no_recommends = dict(default=True, aliases=['no-recommends'], type='bool'),
|
||||||
package = dict(aliases=['pkg', 'name'], required=True)))
|
package = dict(aliases=['pkg', 'name'], required=True)))
|
||||||
|
|
||||||
|
|
||||||
if not os.path.exists(URPMI_PATH):
|
if not os.path.exists(URPMI_PATH):
|
||||||
|
@ -182,7 +182,7 @@ def main():
|
||||||
p = module.params
|
p = module.params
|
||||||
|
|
||||||
force_yes = p['force']
|
force_yes = p['force']
|
||||||
no_suggest_yes = p['no_suggests']
|
no_recommends_yes = p['no_recommends']
|
||||||
|
|
||||||
if p['update_cache']:
|
if p['update_cache']:
|
||||||
update_package_db(module)
|
update_package_db(module)
|
||||||
|
@ -190,7 +190,7 @@ def main():
|
||||||
packages = p['package'].split(',')
|
packages = p['package'].split(',')
|
||||||
|
|
||||||
if p['state'] in [ 'installed', 'present' ]:
|
if p['state'] in [ 'installed', 'present' ]:
|
||||||
install_packages(module, packages, force_yes, no_suggest_yes)
|
install_packages(module, packages, force_yes, no_recommends_yes)
|
||||||
|
|
||||||
elif p['state'] in [ 'removed', 'absent' ]:
|
elif p['state'] in [ 'removed', 'absent' ]:
|
||||||
remove_packages(module, packages)
|
remove_packages(module, packages)
|
||||||
|
|
Loading…
Reference in a new issue