From 173cb01dbee5455b1699477a2fe21c4b75990d80 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 21 Mar 2018 12:49:21 +0100 Subject: [PATCH] Configuring used datacenter in vSphere. --- etc/create-vmware-template.ini.default | 6 ++++-- lib/cr_vmware_tpl/config.py | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/etc/create-vmware-template.ini.default b/etc/create-vmware-template.ini.default index f88ba71..2cac709 100644 --- a/etc/create-vmware-template.ini.default +++ b/etc/create-vmware-template.ini.default @@ -1,13 +1,15 @@ [vSphere] -; host = vcs01.ppbrln.internal +;host = vcs01.ppbrln.internal ;port = 443 -; user = root +;user = root ;password = +;dc = vmcc + ;folder = templates [Template] diff --git a/lib/cr_vmware_tpl/config.py b/lib/cr_vmware_tpl/config.py index b89c9cc..0b9f83f 100644 --- a/lib/cr_vmware_tpl/config.py +++ b/lib/cr_vmware_tpl/config.py @@ -26,7 +26,7 @@ from .errors import FunctionNotImplementedError, PpError from .obj import PpBaseObject -__version__ = '0.2.3' +__version__ = '0.3.1' LOG = logging.getLogger(__name__) @@ -48,6 +48,7 @@ class CrTplConfiguration(PpBaseObject): default_vsphere_host = 'vcs01.ppbrln.internal' default_vsphere_port = 443 default_vsphere_user = 'root' + default_dc = 'vmcc' default_folder = 'templates' default_template_vm = 'template.pixelpark.com' default_template_name = 'oracle-linux-7.4-template' @@ -60,6 +61,7 @@ class CrTplConfiguration(PpBaseObject): self.vsphere_host = self.default_vsphere_host self.vsphere_port = self.default_vsphere_port self.vsphere_user = self.default_vsphere_user + self.dc = self.default_dc self.password = None self.folder = self.default_folder self.template_vm = self.default_template_vm @@ -101,6 +103,7 @@ class CrTplConfiguration(PpBaseObject): res['default_vsphere_host'] = self.default_vsphere_host res['default_vsphere_port'] = self.default_vsphere_port res['default_vsphere_user'] = self.default_vsphere_user + res['default_dc'] = self.default_dc res['default_folder'] = self.default_folder res['default_template_vm'] = self.default_template_vm res['default_template_name'] = self.default_template_name @@ -184,6 +187,8 @@ class CrTplConfiguration(PpBaseObject): continue if key.lower() == 'folder': self.folder = value + if key.lower() == 'dc': + self.dc = value continue -- 2.39.5