Skip to content
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

Clarify docs re mode's octal representation #44410

Merged
merged 4 commits into from
Aug 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/ansible/modules/files/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
mode:
description:
- "Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that
modes are actually octal numbers. You must either specify the leading zero so that
Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it
(like C('644') or C('0644') so Ansible receives a string and can do its own conversion from
modes are actually octal numbers. You must either add a leading zero so that Ansible's
YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it
(like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from
string into number. Giving Ansible a number without following one of these rules will end
up with a decimal number which will have unexpected results. As of version 1.8, the mode
may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). As of
Expand Down
3 changes: 2 additions & 1 deletion lib/ansible/modules/files/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@
'''

EXAMPLES = '''
# change file ownership, group and mode. When specifying mode using octal numbers, first digit should always be 0.
# change file ownership, group and mode
- file:
path: /etc/foo.conf
owner: foo
group: foo
# when specifying mode using octal numbers, add a leading 0
mode: 0644
- file:
path: /work
Expand Down
6 changes: 3 additions & 3 deletions lib/ansible/modules/files/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
mode:
description:
- "Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that
modes are actually octal numbers. You must either specify the leading zero so that
Ansible's YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it
(like C('644') or C('0644') so Ansible receives a string and can do its own conversion from
modes are actually octal numbers. You must either add a leading zero so that Ansible's
YAML parser knows it is an octal number (like C(0644) or C(01777)) or quote it
(like C('644') or C('1777')) so Ansible receives a string and can do its own conversion from
string into number. Giving Ansible a number without following one of these rules will end
up with a decimal number which will have unexpected results. As of version 1.8, the mode
may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r)). As of
Expand Down
4 changes: 2 additions & 2 deletions lib/ansible/utils/module_docs_fragments/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class ModuleDocFragment(object):
mode:
description:
- "Mode the file or directory should be. For those used to I(/usr/bin/chmod) remember that modes are actually octal numbers.
You must either specify the leading zero so that Ansible's YAML parser knows it is an octal
number (like C(0644) or C(01777)) or quote it (like C('644') or C('0644') so Ansible
You must either add a leading zero so that Ansible's YAML parser knows it is an octal
number (like C(0644) or C(01777)) or quote it (like C('644') or C('1777')) so Ansible
receives a string and can do its own conversion from string into number. Giving Ansible a number
without following one of these rules will end up with a decimal number which will have unexpected results.
As of version 1.8, the mode may be specified as a symbolic mode (for example, C(u+rwx) or C(u=rw,g=r,o=r))."
Expand Down