Merge pull request #623 from AdmiralNemo/portage-fixes
Portage fixes for check mode
This commit is contained in:
commit
44eb758dc7
1 changed files with 8 additions and 1 deletions
|
@ -254,6 +254,8 @@ def emerge_packages(module, packages):
|
|||
break
|
||||
else:
|
||||
module.exit_json(changed=False, msg='Packages already present.')
|
||||
if module.check_mode:
|
||||
module.exit_json(changed=True, msg='Packages would be installed.')
|
||||
|
||||
args = []
|
||||
emerge_flags = {
|
||||
|
@ -298,13 +300,18 @@ def emerge_packages(module, packages):
|
|||
changed = True
|
||||
for line in out.splitlines():
|
||||
if re.match(r'(?:>+) Emerging (?:binary )?\(1 of', line):
|
||||
msg = 'Packages installed.'
|
||||
break
|
||||
elif module.check_mode and re.match(r'\[(binary|ebuild)', line):
|
||||
msg = 'Packages would be installed.'
|
||||
break
|
||||
else:
|
||||
changed = False
|
||||
msg = 'No packages installed.'
|
||||
|
||||
module.exit_json(
|
||||
changed=changed, cmd=cmd, rc=rc, stdout=out, stderr=err,
|
||||
msg='Packages installed.',
|
||||
msg=msg,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue