mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Pkgin fixes (#7971)
* Solve exception and spurious "changed" in pkgin * Create changelog * PEP 8 * Update changelogs/fragments/pkgin.yml Co-authored-by: Felix Fontein <felix@fontein.de> --------- Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
49bd9cbd3c
commit
dd25ddfbe8
2 changed files with 10 additions and 1 deletions
2
changelogs/fragments/pkgin.yml
Normal file
2
changelogs/fragments/pkgin.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- pkgin - pkgin (pkgsrc package manager used by SmartOS) raises erratic exceptions and spurious ``changed=true`` (https://github.com/ansible-collections/community.general/pull/7971).
|
|
@ -174,6 +174,13 @@ def query_package(module, name):
|
||||||
# '<' - installed but out of date
|
# '<' - installed but out of date
|
||||||
# '=' - installed and up to date
|
# '=' - installed and up to date
|
||||||
# '>' - installed but newer than the repository version
|
# '>' - installed but newer than the repository version
|
||||||
|
|
||||||
|
if (package in ('reading local summary...',
|
||||||
|
'processing local summary...',
|
||||||
|
'downloading pkg_summary.xz done.')) or \
|
||||||
|
(package.startswith('processing remote summary (')):
|
||||||
|
continue
|
||||||
|
|
||||||
pkgname_with_version, raw_state = package.split(splitchar)[0:2]
|
pkgname_with_version, raw_state = package.split(splitchar)[0:2]
|
||||||
|
|
||||||
# Search for package, stripping version
|
# Search for package, stripping version
|
||||||
|
@ -317,7 +324,7 @@ def do_upgrade_packages(module, full=False):
|
||||||
format_pkgin_command(module, cmd))
|
format_pkgin_command(module, cmd))
|
||||||
|
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
if re.search('^nothing to do.\n$', out):
|
if re.search('^(.*\n|)nothing to do.\n$', out):
|
||||||
module.exit_json(changed=False, msg="nothing left to upgrade")
|
module.exit_json(changed=False, msg="nothing left to upgrade")
|
||||||
else:
|
else:
|
||||||
module.fail_json(msg="could not %s packages" % cmd, stdout=out, stderr=err)
|
module.fail_json(msg="could not %s packages" % cmd, stdout=out, stderr=err)
|
||||||
|
|
Loading…
Reference in a new issue