1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Adds latest to portage module (#21918)

This commit is contained in:
William L. Thomson Jr 2017-02-26 17:21:34 -05:00 committed by Brian Coca
parent d6b40c935f
commit b7229b0467

View file

@ -45,7 +45,7 @@ options:
- State of the package atom
required: false
default: "present"
choices: [ "present", "installed", "emerged", "absent", "removed", "unmerged" ]
choices: [ "present", "installed", "emerged", "absent", "removed", "unmerged", "latest" ]
update:
description:
@ -196,7 +196,7 @@ EXAMPLES = '''
package: foo
state: absent
# Update package foo to the "best" version
# Update package foo to the "latest" version ( os specific alternative to latest )
- portage:
package: foo
update: yes
@ -298,7 +298,7 @@ def sync_repositories(module, webrsync=False):
def emerge_packages(module, packages):
p = module.params
if not (p['update'] or p['noreplace']):
if not (p['update'] or p['noreplace'] or p['state']=='latest'):
for package in packages:
if not query_package(module, package, 'emerge'):
break
@ -328,6 +328,9 @@ def emerge_packages(module, packages):
if p[flag]:
args.append(arg)
if p['state'] and p['state']=='latest':
args.append("--update")
if p['usepkg'] and p['usepkgonly']:
module.fail_json(msg='Use only one of usepkg, usepkgonly')
@ -449,7 +452,7 @@ def run_emerge(module, packages, *args):
return cmd, module.run_command(cmd)
portage_present_states = ['present', 'emerged', 'installed']
portage_present_states = ['present', 'emerged', 'installed', 'latest']
portage_absent_states = ['absent', 'unmerged', 'removed']