diff options
author | dermotbradley <dermot_bradley@yahoo.com> | 2020-10-30 20:12:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 16:12:38 -0400 |
commit | f8c84aeead77b7e508644d94889ee701f20e8d31 (patch) | |
tree | cf1dd65855d28c7d55366a6ab3ce4f7678ebe18e /cloudinit | |
parent | 0f8be879073148f1d67094df9ec895a873caa0d7 (diff) | |
download | vyos-cloud-init-f8c84aeead77b7e508644d94889ee701f20e8d31.tar.gz vyos-cloud-init-f8c84aeead77b7e508644d94889ee701f20e8d31.zip |
Correct documentation and testcase data for some user-data YAML (#618)
For cc_users_groups the user setting "expiredate" must be quoted in
order for the relevant flag and value to be then passed to the useradd
command. It its vaiue is not quoted then it is treated as Python type
datetime.date and in `cloudinit/distros/__init__.py` the below "is it a
string" condition fails and so no "--expiredate" parameter is passed to
useradd and therefore it has no effect:
```
if key in useradd_opts and val and isinstance(val, str):
useradd_cmd.extend([useradd_opts[key], val])
```
For cc_users_groups, the user setting "inactive" does not actually
disable accounts, the useradd "--inactive" option actually defines the
number of days after password expiry that users can still login. So I
have changed the docs to show it taking a quoted value of days (which
works with the current code) rather than a boolean value. The quotes
are necessary, like expiredate above, so that the value is also passed
to the useradd command.
For cc_power_state_change.py the "delay" setting value needs to have
quotes around it as otherwise its leading plus sign will be stripped
off.
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/config/cc_power_state_change.py | 2 | ||||
-rw-r--r-- | cloudinit/config/cc_users_groups.py | 9 |
2 files changed, 6 insertions, 5 deletions
diff --git a/cloudinit/config/cc_power_state_change.py b/cloudinit/config/cc_power_state_change.py index b0cfafcd..5780a7e9 100644 --- a/cloudinit/config/cc_power_state_change.py +++ b/cloudinit/config/cc_power_state_change.py @@ -22,7 +22,7 @@ The ``delay`` key specifies a duration to be added onto any shutdown command used. Therefore, if a 5 minute delay and a 120 second shutdown are specified, the maximum amount of time between cloud-init starting and the system shutting down is 7 minutes, and the minimum amount of time is 5 minutes. The ``delay`` -key must have an argument in either the form ``+5`` for 5 minutes or ``now`` +key must have an argument in either the form ``'+5'`` for 5 minutes or ``now`` for immediate shutdown. Optionally, a command can be run to determine whether or not diff --git a/cloudinit/config/cc_users_groups.py b/cloudinit/config/cc_users_groups.py index d4e923ef..ac4a4410 100644 --- a/cloudinit/config/cc_users_groups.py +++ b/cloudinit/config/cc_users_groups.py @@ -26,13 +26,14 @@ entry of the ``users`` list. Each entry in the ``users`` list, other than a config keys for an entry in ``users`` are as follows: - ``name``: The user's login name - - ``expiredate``: Optional. Date on which the user's login will be + - ``expiredate``: Optional. Date on which the user's account will be disabled. Default: none - ``gecos``: Optional. Comment about the user, usually a comma-separated string of real name and contact information. Default: none - ``groups``: Optional. Additional groups to add the user to. Default: none - ``homedir``: Optional. Home dir for user. Default is ``/home/<username>`` - - ``inactive``: Optional. Mark user inactive. Default: false + - ``inactive``: Optional. Number of days after a password expires until + the account is permanently disabled. Default: none - ``lock_passwd``: Optional. Disable password login. Default: true - ``no_create_home``: Optional. Do not create home directory. Default: false @@ -102,11 +103,11 @@ config keys for an entry in ``users`` are as follows: - name: <some_restricted_user> sudo: false - name: <username> - expiredate: <date> + expiredate: '<date>' gecos: <comment> groups: <additional groups> homedir: <home directory> - inactive: <true/false> + inactive: '<number of days>' lock_passwd: <true/false> no_create_home: <true/false> no_log_init: <true/false> |