← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~msaikia/cloud-init:topic-msaikia-vmware into cloud-init:master

 

Maitreyee Saikia has proposed merging ~msaikia/cloud-init:topic-msaikia-vmware into cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~msaikia/cloud-init/+git/cloud-init/+merge/305427

Part1 for vmware password customization.
-- 
Your team cloud init development team is requested to review the proposed merge of ~msaikia/cloud-init:topic-msaikia-vmware into cloud-init:master.
diff --git a/cloudinit/sources/helpers/vmware/imc/config.py b/cloudinit/sources/helpers/vmware/imc/config.py
index d645c49..a86233f 100644
--- a/cloudinit/sources/helpers/vmware/imc/config.py
+++ b/cloudinit/sources/helpers/vmware/imc/config.py
@@ -17,6 +17,8 @@
 #    You should have received a copy of the GNU General Public License
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import re
+
 from .nic import Nic
 
 
@@ -28,11 +30,15 @@ class Config(object):
 
     DNS = 'DNS|NAMESERVER|'
     SUFFIX = 'DNS|SUFFIX|'
-    PASS = 'PASSWORD|-PASS'
     TIMEZONE = 'DATETIME|TIMEZONE'
     UTC = 'DATETIME|UTC'
     HOSTNAME = 'NETWORK|HOSTNAME'
     DOMAINNAME = 'NETWORK|DOMAINNAME'
+    CUSTOM_SCRIPT = 'CUSTOM-SCRIPT|SCRIPT-NAME'
+    PASS = 'PASSWORD|-PASS'
+    RESETPASS = 'PASSWORD|RESET'
+    MARKERID = 'MISC|MARKER-ID'
+    POST_GC = 'MISC|POST-GC-STATUS'
 
     def __init__(self, configFile):
         self._configFile = configFile
@@ -58,11 +64,6 @@ class Config(object):
         return self._configFile.get(Config.UTC, None)
 
     @property
-    def admin_password(self):
-        """Return the root password to be set."""
-        return self._configFile.get(Config.PASS, None)
-
-    @property
     def name_servers(self):
         """Return the list of DNS servers."""
         res = []
@@ -93,3 +94,34 @@ class Config(object):
             res.append(Nic(nic, self._configFile))
 
         return res
+
+    @property
+    def admin_password(self):
+        """Return the root password to be set."""
+        return self._configFile.get(Config.PASS, None)
+
+    @property
+    def reset_password(self):
+        """Retreives if the root password needs to be reset."""
+        resetPass = self._configFile.get(Config.RESETPASS, None)
+        if resetPass and not re.match('yes$|no$', resetPass.lower()):
+            raise ValueError("ResetPassword value should be yes/no")
+        return resetPass
+
+    @property
+    def marker_id(self):
+        """Returns marker id."""
+        return self._configFile.get(Config.MARKERID, None)
+
+    @property
+    def GetPostGcStatus(self):
+        """Retreives if customization status needs to be posted."""
+        postGcStatus = self._configFile.get(Config.POST_GC, None)
+        if postGcStatus and not re.match('yes$|no$', postGcStatus.lower()):
+            raise ValueError("GC status value should be yes/no")
+        return postGcStatus
+
+    @property
+    def GetCustomScriptName(self):
+        """Return the name of custom (pre/post) script."""
+        return self._configFile.get(Config.CUSTOM_SCRIPT, None)

Follow ups