-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add umask option for mount module #209
Open
satken2
wants to merge
14
commits into
ansible-collections:main
Choose a base branch
from
satken2:issue163
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
52d040c
Add mode option for mount module
dce9f57
Add mode option for mount module
d7735d3
Fix description of the parameter
satken2 30c7360
correct changelog fragment
satken2 f919496
Add version_added parameter to documentation
6663bf5
Merge branch 'issue163' of https://github.com/satken2/ansible.posix i…
d9f85d3
Add mode option for mount module
c14f4d7
Add umask option for mount module
d6ae098
Add umask option for mount module
d2c5f21
Add umask option for mount module
f765706
Add umask option for mount module
b7424f4
Add umask option for mount module
satken2 5845277
Add umask option for mount module
3dd7712
Merge branch 'issue163' of https://github.com/satken2/ansible.posix i…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
minor_changes: | ||
- mount - add ``umask`` parameter to control permissions of the directories created by the module (https://github.com/ansible-collections/ansible.posix/issues/163). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,3 +332,79 @@ | |
- /tmp/myfs.img | ||
- /tmp/myfs | ||
when: ansible_system in ('Linux') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a integration test which uses something like |
||
- name: Block to test umask option | ||
block: | ||
- name: Make sure that mount point does not exist | ||
file: | ||
path: /tmp/mount_dest | ||
state: absent | ||
- name: Create a directory to bind mount | ||
file: | ||
state: directory | ||
path: /tmp/mount_source | ||
- name: Bind mount a filesystem with umask | ||
mount: | ||
src: /tmp/mount_source | ||
path: /tmp/mount_dest | ||
state: mounted | ||
fstype: None | ||
opts: bind | ||
umask: 0777 | ||
when: ansible_system != 'FreeBSD' | ||
- name: Bind mount a filesystem with umask(FreeBSD) | ||
mount: | ||
src: /tmp/mount_source | ||
path: /tmp/mount_dest | ||
state: mounted | ||
fstype: nullfs | ||
umask: 0777 | ||
when: ansible_system == 'FreeBSD' | ||
- name: Unmount FS to access underlying directory | ||
command: | | ||
umount /tmp/mount_dest | ||
- name: Stat mount point directory | ||
stat: | ||
path: /tmp/mount_dest | ||
register: mount_point_stat | ||
- name: Assert that the mount point has right permission | ||
assert: | ||
that: | ||
- mount_point_stat['stat']['mode'] == '0000' | ||
- name: Cleanup directory | ||
file: | ||
path: /tmp/mount_dest | ||
state: absent | ||
- name: Bind mount a filesystem with string umask | ||
mount: | ||
src: /tmp/mount_source | ||
path: /tmp/mount_dest | ||
state: mounted | ||
fstype: None | ||
opts: bind | ||
umask: "0777" | ||
when: ansible_system != 'FreeBSD' | ||
- name: Bind mount a filesystem with string umask(FreeBSD) | ||
mount: | ||
src: /tmp/mount_source | ||
path: /tmp/mount_dest | ||
state: mounted | ||
fstype: nullfs | ||
umask: "0777" | ||
when: ansible_system == 'FreeBSD' | ||
- name: Unmount FS to access underlying directory | ||
command: | | ||
umount /tmp/mount_dest | ||
- name: Stat mount point directory | ||
stat: | ||
path: /tmp/mount_dest | ||
register: mount_point_stat | ||
- name: Assert that the mount point has right permission | ||
assert: | ||
that: | ||
- mount_point_stat['stat']['mode'] == '0000' | ||
- name: Remove the test FS | ||
file: | ||
path: /tmp/mount_dest | ||
state: absent | ||
when: ansible_system not in ('Darwin') |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change this to a 'strict string' to avoid all the 'octal/int' issues as we had to go through with mode in other modules.