From d98ad7b3746bad393bb2fb431b0464cca34eac2b Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Fri, 2 Aug 2013 20:32:56 -0500 Subject: [PATCH] Set result to skipped when vol group is missing and lv state=absent Fixes issue #3714 - lvol module state=absent fails (with error) if the volume group doesn't exist --- library/system/lvol | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/system/lvol b/library/system/lvol index b0201016b3f..234dd5510ac 100644 --- a/library/system/lvol +++ b/library/system/lvol @@ -141,7 +141,10 @@ def main(): rc,current_lvs,err = module.run_command("lvs --noheadings -o lv_name,size --units %s --separator ';' %s" % (unit, vg)) if rc != 0: - module.fail_json(msg="Volume group %s does not exist."%vg, rc=rc, err=err) + if state == 'absent': + module.exit_json(changed=False,skipped=True,stdout="Skipping because volume group %s does not exist." % vg,stderr=False) + else: + module.fail_json(msg="Volume group %s does not exist."%vg, rc=rc, err=err) changed = False