diff options
author | Maitreyee Saikia <msaikia@vmware.com> | 2017-08-15 09:33:50 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2017-08-15 09:33:50 -0600 |
commit | 1f8183ff4750cc7f8798749987ef10912719544d (patch) | |
tree | 34bb4eb37c3a358a617181476f0a670681f1af8b /cloudinit/sources/helpers/vmware/imc/config.py | |
parent | d5f855dd96ccbea77f61b0515b574ad2c43d116d (diff) | |
download | vyos-cloud-init-1f8183ff4750cc7f8798749987ef10912719544d.tar.gz vyos-cloud-init-1f8183ff4750cc7f8798749987ef10912719544d.zip |
vcloud directory: Guest Customization support for passwords
This feature enables the following VMware VCloud Director functionality:
1. Setting admin password
2. Expire password.
3. Set admin password and expire.
Password configuration is triggered only as part of a full
recustomization, that happens either on first power on or when
"poweron and full recustomization" is selected. Full customization
flow is determined by marker files. Unique marker ids are
generated when full recustomization is requested. And marker file based
on these marker ids help to determine if we need to execute the above
configuration.
Diffstat (limited to 'cloudinit/sources/helpers/vmware/imc/config.py')
-rw-r--r-- | cloudinit/sources/helpers/vmware/imc/config.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/cloudinit/sources/helpers/vmware/imc/config.py b/cloudinit/sources/helpers/vmware/imc/config.py index 9a5e3a8a..49d441db 100644 --- a/cloudinit/sources/helpers/vmware/imc/config.py +++ b/cloudinit/sources/helpers/vmware/imc/config.py @@ -5,6 +5,7 @@ # # This file is part of cloud-init. See LICENSE file for license information. + from .nic import Nic @@ -14,13 +15,16 @@ class Config(object): Specification file. """ + CUSTOM_SCRIPT = 'CUSTOM-SCRIPT|SCRIPT-NAME' DNS = 'DNS|NAMESERVER|' - SUFFIX = 'DNS|SUFFIX|' + DOMAINNAME = 'NETWORK|DOMAINNAME' + HOSTNAME = 'NETWORK|HOSTNAME' + MARKERID = 'MISC|MARKER-ID' PASS = 'PASSWORD|-PASS' + RESETPASS = 'PASSWORD|RESET' + SUFFIX = 'DNS|SUFFIX|' TIMEZONE = 'DATETIME|TIMEZONE' UTC = 'DATETIME|UTC' - HOSTNAME = 'NETWORK|HOSTNAME' - DOMAINNAME = 'NETWORK|DOMAINNAME' def __init__(self, configFile): self._configFile = configFile @@ -82,4 +86,18 @@ class Config(object): return res + @property + def reset_password(self): + """Retreives if the root password needs to be reset.""" + resetPass = self._configFile.get(Config.RESETPASS, 'no') + resetPass = resetPass.lower() + if resetPass not in ('yes', 'no'): + raise ValueError('ResetPassword value should be yes/no') + return resetPass == 'yes' + + @property + def marker_id(self): + """Returns marker id.""" + return self._configFile.get(Config.MARKERID, None) + # vi: ts=4 expandtab |