mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
* aix_filesystems - invoke run_command passing list
* added changelog fragment
(cherry picked from commit 70f73f42f8
)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
parent
cfeb40ed23
commit
ca9c763b57
2 changed files with 12 additions and 14 deletions
2
changelogs/fragments/3833-aix_filesystem-run-list.yaml
Normal file
2
changelogs/fragments/3833-aix_filesystem-run-list.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
minor_changes:
|
||||
- aix_filesystem - calling ``run_command`` with arguments as ``list`` instead of ``str`` (https://github.com/ansible-collections/community.general/pull/3833).
|
|
@ -183,7 +183,7 @@ def _fs_exists(module, filesystem):
|
|||
:return: True or False.
|
||||
"""
|
||||
lsfs_cmd = module.get_bin_path('lsfs', True)
|
||||
rc, lsfs_out, err = module.run_command("%s -l %s" % (lsfs_cmd, filesystem))
|
||||
rc, lsfs_out, err = module.run_command([lsfs_cmd, "-l", filesystem])
|
||||
if rc == 1:
|
||||
if re.findall("No record matching", err):
|
||||
return False
|
||||
|
@ -206,8 +206,7 @@ def _check_nfs_device(module, nfs_host, device):
|
|||
:return: True or False.
|
||||
"""
|
||||
showmount_cmd = module.get_bin_path('showmount', True)
|
||||
rc, showmount_out, err = module.run_command(
|
||||
"%s -a %s" % (showmount_cmd, nfs_host))
|
||||
rc, showmount_out, err = module.run_command([showmount_cmd, "-a", nfs_host])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to run showmount. Error message: %s" % err)
|
||||
else:
|
||||
|
@ -229,11 +228,11 @@ def _validate_vg(module, vg):
|
|||
None (VG does not exist), message.
|
||||
"""
|
||||
lsvg_cmd = module.get_bin_path('lsvg', True)
|
||||
rc, current_active_vgs, err = module.run_command("%s -o" % lsvg_cmd)
|
||||
rc, current_active_vgs, err = module.run_command([lsvg_cmd, "-o"])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed executing %s command." % lsvg_cmd)
|
||||
|
||||
rc, current_all_vgs, err = module.run_command("%s" % lsvg_cmd)
|
||||
rc, current_all_vgs, err = module.run_command([lsvg_cmd, "%s"])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed executing %s command." % lsvg_cmd)
|
||||
|
||||
|
@ -253,7 +252,7 @@ def resize_fs(module, filesystem, size):
|
|||
|
||||
chfs_cmd = module.get_bin_path('chfs', True)
|
||||
if not module.check_mode:
|
||||
rc, chfs_out, err = module.run_command('%s -a size="%s" %s' % (chfs_cmd, size, filesystem))
|
||||
rc, chfs_out, err = module.run_command([chfs_cmd, "-a", "size=%s" % size, filesystem])
|
||||
|
||||
if rc == 28:
|
||||
changed = False
|
||||
|
@ -338,8 +337,7 @@ def create_fs(
|
|||
# Creates a NFS file system.
|
||||
mknfsmnt_cmd = module.get_bin_path('mknfsmnt', True)
|
||||
if not module.check_mode:
|
||||
rc, mknfsmnt_out, err = module.run_command('%s -f "%s" %s -h "%s" -t "%s" "%s" -w "bg"' % (
|
||||
mknfsmnt_cmd, filesystem, device, nfs_server, permissions, auto_mount))
|
||||
rc, mknfsmnt_out, err = module.run_command([mknfsmnt_cmd, "-f", filesystem, device, "-h", nfs_server, "-t", permissions, auto_mount, "-w", "bg"])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to run mknfsmnt. Error message: %s" % err)
|
||||
else:
|
||||
|
@ -357,8 +355,7 @@ def create_fs(
|
|||
# Creates a LVM file system.
|
||||
crfs_cmd = module.get_bin_path('crfs', True)
|
||||
if not module.check_mode:
|
||||
cmd = "%s -v %s -m %s %s %s %s %s %s -p %s %s -a %s" % (
|
||||
crfs_cmd, fs_type, filesystem, vg, device, mount_group, auto_mount, account_subsystem, permissions, size, attributes)
|
||||
cmd = [crfs_cmd, "-v", fs_type, "-m", filesystem, vg, device, mount_group, auto_mount, account_subsystem, "-p", permissions, size, "-a", attributes]
|
||||
rc, crfs_out, err = module.run_command(cmd)
|
||||
|
||||
if rc == 10:
|
||||
|
@ -392,7 +389,7 @@ def remove_fs(module, filesystem, rm_mount_point):
|
|||
|
||||
rmfs_cmd = module.get_bin_path('rmfs', True)
|
||||
if not module.check_mode:
|
||||
cmd = "%s -r %s %s" % (rmfs_cmd, rm_mount_point, filesystem)
|
||||
cmd = [rmfs_cmd, "-r", rm_mount_point, filesystem]
|
||||
rc, rmfs_out, err = module.run_command(cmd)
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to run %s. Error message: %s" % (cmd, err))
|
||||
|
@ -415,8 +412,7 @@ def mount_fs(module, filesystem):
|
|||
mount_cmd = module.get_bin_path('mount', True)
|
||||
|
||||
if not module.check_mode:
|
||||
rc, mount_out, err = module.run_command(
|
||||
"%s %s" % (mount_cmd, filesystem))
|
||||
rc, mount_out, err = module.run_command([mount_cmd, filesystem])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to run mount. Error message: %s" % err)
|
||||
else:
|
||||
|
@ -436,7 +432,7 @@ def unmount_fs(module, filesystem):
|
|||
unmount_cmd = module.get_bin_path('unmount', True)
|
||||
|
||||
if not module.check_mode:
|
||||
rc, unmount_out, err = module.run_command("%s %s" % (unmount_cmd, filesystem))
|
||||
rc, unmount_out, err = module.run_command([unmount_cmd, filesystem])
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to run unmount. Error message: %s" % err)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue