mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixed bug that occurred when pkgsite not specified
This commit is contained in:
parent
064722aa5e
commit
17fcc89b3b
1 changed files with 6 additions and 4 deletions
|
@ -142,9 +142,11 @@ def install_packages(module, pkgng_path, packages, cached, pkgsite):
|
||||||
# as of pkg-1.1.4, PACKAGESITE is deprecated in favor of repository definitions
|
# as of pkg-1.1.4, PACKAGESITE is deprecated in favor of repository definitions
|
||||||
# in /usr/local/etc/pkg/repos
|
# in /usr/local/etc/pkg/repos
|
||||||
old_pkgng = pkgng_older_than(module, pkgng_path, [1, 1, 4])
|
old_pkgng = pkgng_older_than(module, pkgng_path, [1, 1, 4])
|
||||||
|
if pkgsite != "":
|
||||||
if old_pkgng and (pkgsite != ""):
|
if old_pkgng:
|
||||||
pkgsite = "PACKAGESITE=%s" % (pkgsite)
|
pkgsite = "PACKAGESITE=%s" % (pkgsite)
|
||||||
|
else:
|
||||||
|
pkgsite = "-r %s" % (pkgsite)
|
||||||
|
|
||||||
if not module.check_mode and cached == "no":
|
if not module.check_mode and cached == "no":
|
||||||
if old_pkgng:
|
if old_pkgng:
|
||||||
|
@ -162,7 +164,7 @@ def install_packages(module, pkgng_path, packages, cached, pkgsite):
|
||||||
if old_pkgng:
|
if old_pkgng:
|
||||||
rc, out, err = module.run_command("%s %s install -g -U -y %s" % (pkgsite, pkgng_path, package))
|
rc, out, err = module.run_command("%s %s install -g -U -y %s" % (pkgsite, pkgng_path, package))
|
||||||
else:
|
else:
|
||||||
rc, out, err = module.run_command("%s install -r %s -g -U -y %s" % (pkgng_path, pkgsite, package))
|
rc, out, err = module.run_command("%s install %s -g -U -y %s" % (pkgng_path, pkgsite, package))
|
||||||
|
|
||||||
if not module.check_mode and not query_package(module, pkgng_path, package):
|
if not module.check_mode and not query_package(module, pkgng_path, package):
|
||||||
module.fail_json(msg="failed to install %s: %s" % (package, out), stderr=err)
|
module.fail_json(msg="failed to install %s: %s" % (package, out), stderr=err)
|
||||||
|
|
Loading…
Reference in a new issue