Clarify "mode" even more : String + leading 0
This commit is contained in:
parent
b8c43d2b12
commit
200ec1063f
|
@ -214,13 +214,13 @@ For example for the "mysql" role we obviously need the MySQL packages, but we al
|
||||||
|
|
||||||
### Unix permissions must be written as String values
|
### Unix permissions must be written as String values
|
||||||
|
|
||||||
Many modules have a `mode` attribute to specify the permissions on the files or directories. We can use the symbolic notation (`u+rwx` or `u=rw,g=r,o=r`) or the octal notation (`755`).
|
Many modules have a `mode` attribute to specify the permissions on the files or directories. We can use the symbolic notation (`u+rwx` or `u=rw,g=r,o=r`) or the octal notation (`0755`).
|
||||||
|
|
||||||
It is not clearly documented but when using the octal notation, we **MUST** use a String format, and not a Numeric format (or whatever Python types). Examples :
|
It is clearly documented that when using the octal notation a leading 0 must be present, but it is not clearly documented that we **MUST** use a String format, and not a Numeric format (or whatever Python types). Examples :
|
||||||
|
|
||||||
* `mode: 755` → Bad!
|
* `mode: 755` → Bad!
|
||||||
* `mode: 1777` → Bad!
|
* `mode: 1777` → Bad!
|
||||||
* `mode: "755"` → Good
|
* `mode: "0755"` → Good
|
||||||
* `mode: "1777"` → Good
|
* `mode: "1777"` → Good
|
||||||
|
|
||||||
This is most probably due to the way Python deals with numeric values and cotal vs. decimal based integers. The String type guarantees that the proper value is used.
|
This is most probably due to the way Python deals with numeric values and cotal vs. decimal based integers. The String type guarantees that the proper value is used.
|
||||||
|
|
Loading…
Reference in a new issue