1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

[PR #8052/73b6b98e backport][stable-7] Aix filesystem crfs issue (#8111)

Aix filesystem crfs issue (#8052)

* crfs issue in aix_filesystem.py

Change the crfs logic and fields, since empty options and order seem to be an issue.

this quick fix seems to solve it

* Create aix_filesystem-crfs-issue.yml

changelog fragment

* fix

fix typo

* Update changelogs/fragments/aix_filesystem-crfs-issue.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Refactored based on feeback and testing

Refactored the changes i did based on the comments and testing. Also changed the attribute default values because they were causing errors

* blank line whitespaces

* fix default

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 73b6b98ed9)

Co-authored-by: Mike <mike@php-webdesign.nl>
This commit is contained in:
patchback[bot] 2024-03-17 17:40:35 +01:00 committed by GitHub
parent 07fa35791f
commit a8be2e2a58
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 53 additions and 4 deletions

View file

@ -0,0 +1,3 @@
---
bugfixes:
- aix_filesystem - fix issue with empty list items in crfs logic and option order (https://github.com/ansible-collections/community.general/pull/8052).

View file

@ -38,8 +38,8 @@ options:
type: list
elements: str
default:
- agblksize='4096'
- isnapshot='no'
- agblksize=4096
- isnapshot=no
auto_mount:
description:
- File system is automatically mounted at system restart.
@ -365,7 +365,53 @@ def create_fs(
# Creates a LVM file system.
crfs_cmd = module.get_bin_path('crfs', True)
if not module.check_mode:
cmd = [crfs_cmd, "-v", fs_type, "-m", filesystem, vg, device, mount_group, auto_mount, account_subsystem, "-p", permissions, size, "-a", attributes]
cmd = [crfs_cmd]
cmd.append("-v")
cmd.append(fs_type)
if vg:
(flag, value) = vg.split()
cmd.append(flag)
cmd.append(value)
if device:
(flag, value) = device.split()
cmd.append(flag)
cmd.append(value)
cmd.append("-m")
cmd.append(filesystem)
if mount_group:
(flag, value) = mount_group.split()
cmd.append(flag)
cmd.append(value)
if auto_mount:
(flag, value) = auto_mount.split()
cmd.append(flag)
cmd.append(value)
if account_subsystem:
(flag, value) = account_subsystem.split()
cmd.append(flag)
cmd.append(value)
cmd.append("-p")
cmd.append(permissions)
if size:
(flag, value) = size.split()
cmd.append(flag)
cmd.append(value)
if attributes:
splitted_attributes = attributes.split()
cmd.append("-a")
for value in splitted_attributes:
cmd.append(value)
rc, crfs_out, err = module.run_command(cmd)
if rc == 10:
@ -461,7 +507,7 @@ def main():
module = AnsibleModule(
argument_spec=dict(
account_subsystem=dict(type='bool', default=False),
attributes=dict(type='list', elements='str', default=["agblksize='4096'", "isnapshot='no'"]),
attributes=dict(type='list', elements='str', default=["agblksize=4096", "isnapshot=no"]),
auto_mount=dict(type='bool', default=True),
device=dict(type='str'),
filesystem=dict(type='str', required=True),