Skip to content

Commit

Permalink
Merge pull request #185 from saito-hideki/issue/184
Browse files Browse the repository at this point in the history
[mount] Fix boot option handling on Solaris correctly

Reviewed-by: https://github.com/apps/ansible-zuul
  • Loading branch information
ansible-zuul[bot] authored May 27, 2021
2 parents eaf3d66 + 0bef7bb commit 5d0c8e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions changelogs/fragments/185_mount_at_boot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- "mount - Handle ``boot`` option on Solaris correctly (https://github.com/ansible-collections/ansible.posix/issues/184)."
7 changes: 6 additions & 1 deletion plugins/modules/mount.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@
from ansible_collections.ansible.posix.plugins.module_utils.mount import ismount
from ansible.module_utils.six import iteritems
from ansible.module_utils._text import to_bytes, to_native
from ansible.module_utils.parsing.convert_bool import boolean


def write_fstab(module, lines, path):
Expand Down Expand Up @@ -672,7 +673,7 @@ def main():
opts='-',
passno='-',
fstab=module.params['fstab'],
boot='yes'
boot='yes' if module.params['boot'] else 'no'
)
if args['fstab'] is None:
args['fstab'] = '/etc/vfstab'
Expand Down Expand Up @@ -834,6 +835,10 @@ def main():
else:
module.fail_json(msg='Unexpected position reached')

# If the managed node is Solaris, convert the boot value type to Boolean
# to match the type of return value with the module argument.
if platform.system().lower() == 'sunos':
args['boot'] = boolean(args['boot'])
module.exit_json(changed=changed, **args)


Expand Down

0 comments on commit 5d0c8e4

Please sign in to comment.