diff options
author | Brian Coca <bcoca@ansible.com> | 2015-01-09 16:04:45 -0500 |
---|---|---|
committer | Brian Coca <bcoca@ansible.com> | 2015-01-09 16:04:45 -0500 |
commit | ffa8abf9793a92bff6708d1f9a2a45475177f834 (patch) | |
tree | b4694fe01ebb79cf4e6d15b5b76820988aa587a4 | |
parent | a32869d492f5e2adbfda4a132d565c8219d18890 (diff) | |
parent | 20ef2696bcfa2b2ed68b75d4f79b4f88f49216aa (diff) | |
download | ansible-modules-extras-ffa8abf9793a92bff6708d1f9a2a45475177f834.tar.gz |
Merge pull request #120 from alxgu/lvol_fix_path
Fix lvol: Find LVM commands in PATH env - Bugfix Pull Request
-rw-r--r-- | system/lvol.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/system/lvol.py b/system/lvol.py index 96f1b846..e9d477ed 100644 --- a/system/lvol.py +++ b/system/lvol.py @@ -152,8 +152,9 @@ def main(): else: unit = size_unit + lvs_cmd = module.get_bin_path("lvs", required=True) rc, current_lvs, err = module.run_command( - "lvs --noheadings -o lv_name,size --units %s --separator ';' %s" % (unit, vg)) + "%s --noheadings -o lv_name,size --units %s --separator ';' %s" % (lvs_cmd, unit, vg)) if rc != 0: if state == 'absent': @@ -185,7 +186,8 @@ def main(): if module.check_mode: changed = True else: - rc, _, err = module.run_command("lvcreate -n %s -%s %s%s %s" % (lv, size_opt, size, size_unit, vg)) + lvcreate_cmd = module.get_bin_path("lvcreate", required=True) + rc, _, err = module.run_command("%s -n %s -%s %s%s %s" % (lvcreate_cmd, lv, size_opt, size, size_unit, vg)) if rc == 0: changed = True else: @@ -197,7 +199,8 @@ def main(): module.exit_json(changed=True) if not force: module.fail_json(msg="Sorry, no removal of logical volume %s without force=yes." % (this_lv['name'])) - rc, _, err = module.run_command("lvremove --force %s/%s" % (vg, this_lv['name'])) + lvremove_cmd = module.get_bin_path("lvremove", required=True) + rc, _, err = module.run_command("%s --force %s/%s" % (lvremove_cmd, vg, this_lv['name'])) if rc == 0: module.exit_json(changed=True) else: @@ -209,11 +212,12 @@ def main(): ### resize LV tool = None if size > this_lv['size']: - tool = 'lvextend' + tool = module.get_bin_path("lvextend", required=True) elif size < this_lv['size']: if not force: module.fail_json(msg="Sorry, no shrinking of %s without force=yes." % (this_lv['name'])) - tool = 'lvreduce --force' + tool = module.get_bin_path("lvextend", required=True) + tool.append("--force") if tool: if module.check_mode: |