From e9d5cf3bc2d0b7c01dbd11cffb828f17ea38cd5e Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sat, 26 Jan 2013 12:44:43 -0500 Subject: [PATCH] Fix documentation YAML for pkgin module --- Makefile | 4 ++++ library/pkgin | 24 +++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 1d7a0ff4a7..4e5d1ee4f6 100644 --- a/Makefile +++ b/Makefile @@ -180,3 +180,7 @@ modulejs: webdocs: (cd docsite; make docs) +# just for quick testing of all the module docs +webdocs2: + (cd docsite; make modules) + diff --git a/library/pkgin b/library/pkgin index eec541135b..05891d3f63 100755 --- a/library/pkgin +++ b/library/pkgin @@ -26,29 +26,27 @@ module: pkgin short_description: Package manager for SmartOS description: - Manages SmartOS packages - version_added: "1.0" options: name: description: - name of package to install/remove required: true - state: description: - - state of the package installed or absent. + - state of the package + choices: [ 'present', 'absent' ] required: false - + default: present author: Shaun Zinck notes: [] examples: - - code: "pkgin: name=foo state=installed" + - code: "pkgin: name=foo state=present" description: install package foo" - code: "pkgin: name=foo state=absent" description: remove package foo - - code: "pkgin: name=foo,bar state=absent + - code: "pkgin: name=foo,bar state=absent" description: remove packages foo and bar - ''' @@ -59,9 +57,9 @@ import sys PKGIN_PATH = "/opt/local/bin/pkgin" -def query_package(module, name, state="installed"): +def query_package(module, name, state="present"): - if state == "installed": + if state == "present": rc, out, err = module.run_command("%s list | grep ^%s" % (PKGIN_PATH, name)) @@ -110,16 +108,16 @@ def install_packages(module, packages): install_c += 1 if install_c > 0: - module.exit_json(changed=True, msg="installed %s package(s)" % (install_c)) + module.exit_json(changed=True, msg="present %s package(s)" % (install_c)) - module.exit_json(changed=False, msg="package(s) already installed") + module.exit_json(changed=False, msg="package(s) already present") def main(): module = AnsibleModule( argument_spec = dict( - state = dict(default="installed", choices=["installed","absent"]), + state = dict(default="present", choices=["present","absent"]), name = dict(aliases=["pkg"], required=True))) @@ -130,7 +128,7 @@ def main(): pkgs = p["name"].split(",") - if p["state"] == "installed": + if p["state"] == "present": install_packages(module, pkgs) elif p["state"] == "absent":