]> Frank Brehm's Git Trees - pixelpark/create-vmware-tpl.git/commitdiff
Ensuring VM folder for VM
authorFrank Brehm <frank.brehm@pixelpark.com>
Wed, 24 Oct 2018 11:02:11 +0000 (13:02 +0200)
committerFrank Brehm <frank.brehm@pixelpark.com>
Wed, 24 Oct 2018 11:02:11 +0000 (13:02 +0200)
lib/cr_vmware_tpl/handler.py
python_fb_tools

index 399c670cb52e52aed85e382c5d61fc0332fd1b72..9996cc84f4aa3543824bed318848a2e6ca5dad40 100644 (file)
@@ -158,6 +158,8 @@ class CrTplHandler(BaseHandler):
             LOG.error("Could not find VSphere cluster {!r}.".format(self.config.vsphere_cluster))
             return 6
 
+        self.vsphere.ensure_vm_folder(self.config.folder)
+
         return 0
 
 
@@ -181,7 +183,7 @@ class CrTplHandler(BaseHandler):
 
         try:
 #            self.get_cluster()
-            self.ensure_vm_folder()
+#            self.ensure_vm_folder()
             self.check_for_temp_tpl_vm()
             self.select_data_store()
             if self.rotate_only:
@@ -320,23 +322,6 @@ class CrTplHandler(BaseHandler):
 
         return None
 
-    # -------------------------------------------------------------------------
-    def ensure_vm_folder(self):
-
-        content = self.service_instance.RetrieveContent()
-        dc = self.get_obj(content, [vim.Datacenter], self.config.dc)
-
-        tpl_vm_folder = self.get_tpl_folder(dc.vmFolder)
-        if tpl_vm_folder:
-            self.tpl_vm_folder = tpl_vm_folder
-            return True
-
-        self._create_folder(dc.vmFolder, self.config.folder, 'VM')
-
-        self.tpl_vm_folder = self.get_tpl_folder()
-
-        return True
-
     # -------------------------------------------------------------------------
     def check_for_temp_tpl_vm(self):
 
index 1a34235b15900c1fdeb5e3550c820ccfe2c16455..001e1212e80247f144ad8291e8aec6588cfdf6fe 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 1a34235b15900c1fdeb5e3550c820ccfe2c16455
+Subproject commit 001e1212e80247f144ad8291e8aec6588cfdf6fe