Add --jail support to pkgng. ()

* Add --jail support to pkgng.

* Bump the version number for the --jail argument.
This commit is contained in:
Dr Josef Karthauser 2017-03-28 22:38:47 +01:00 committed by Brian Coca
parent 37cef2a9eb
commit 0752906ae5

View file

@ -72,14 +72,19 @@ options:
description: description:
- For pkgng versions 1.5 and later, pkg will install all packages - For pkgng versions 1.5 and later, pkg will install all packages
within the specified root directory. within the specified root directory.
- Can not be used together with I(chroot) option. - Can not be used together with I(chroot) or I(jail) options.
required: false required: false
chroot: chroot:
version_added: "2.1" version_added: "2.1"
description: description:
- Pkg will chroot in the specified environment. - Pkg will chroot in the specified environment.
- Can not be used together with I(rootdir) option. - Can not be used together with I(rootdir) or I(jail) options.
required: false required: false
jail:
version_added: "2.4"
description:
- Pkg will execute in the given jail name or id.
- Can not be used together with I(chroot) or I(rootdir) options.
autoremove: autoremove:
version_added: "2.2" version_added: "2.2"
description: description:
@ -314,9 +319,10 @@ def main():
pkgsite = dict(default="", required=False), pkgsite = dict(default="", required=False),
rootdir = dict(default="", required=False, type='path'), rootdir = dict(default="", required=False, type='path'),
chroot = dict(default="", required=False, type='path'), chroot = dict(default="", required=False, type='path'),
jail = dict(default="", required=False, type='str'),
autoremove = dict(default=False, type='bool')), autoremove = dict(default=False, type='bool')),
supports_check_mode = True, supports_check_mode = True,
mutually_exclusive =[["rootdir", "chroot"]]) mutually_exclusive =[["rootdir", "chroot", "jail"]])
pkgng_path = module.get_bin_path('pkg', True) pkgng_path = module.get_bin_path('pkg', True)
@ -338,6 +344,9 @@ def main():
if p["chroot"] != "": if p["chroot"] != "":
dir_arg = '--chroot %s' % (p["chroot"]) dir_arg = '--chroot %s' % (p["chroot"])
if p["jail"] != "":
dir_arg = '--jail %s' % (p["jail"])
if p["state"] == "present": if p["state"] == "present":
_changed, _msg = install_packages(module, pkgng_path, pkgs, p["cached"], p["pkgsite"], dir_arg) _changed, _msg = install_packages(module, pkgng_path, pkgs, p["cached"], p["pkgsite"], dir_arg)
changed = changed or _changed changed = changed or _changed