From 200ec1063f93ba4e7e0170506a47cdaf3813d9e9 Mon Sep 17 00:00:00 2001 From: Jeremy Lecour Date: Fri, 24 Mar 2017 15:28:51 +0100 Subject: [PATCH] Clarify "mode" even more : String + leading 0 --- CONVENTIONS.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CONVENTIONS.md b/CONVENTIONS.md index ad1fb45..1fe9455 100644 --- a/CONVENTIONS.md +++ b/CONVENTIONS.md @@ -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 -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: 1777` → Bad! -* `mode: "755"` → Good +* `mode: "0755"` → 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.