from .xlate import __mo_file__ as __xlate_mo_file__
from .xlate import XLATOR, LOCALE_DIR, DOMAIN
-__version__ = '1.3.4'
+__version__ = '1.3.5'
LOG = logging.getLogger(__name__)
SIGNAL_NAMES = {
prompt = self.colored(_("User password of {!r}").format(
self.handler.vsphere_user), 'AQUA')
item = _('Password for user {u!r} of vSphere {n} on {h!r}').format(
- u=self.handler.vsphere_user, n=vsphere_name, h=self.config.vsphere[vsphere_name].host)
+ u=self.handler.vsphere_user, n=vsphere_name,
+ h=self.config.vsphere[vsphere_name].host)
item = self.colored(item, 'AQUA')
self.handler.vsphere_password = self.get_secret(prompt=prompt, item_name=item)
if not self.handler.vsphere_password:
from ..xlate import XLATOR
-__version__ = '4.0.0'
+__version__ = '4.0.1'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
steps = (
'init', 'vmw-init', 'read-yaml', 'pdns-zones', 'vmw-test', 'collect-folders',
- 'vmw-clusters', 'vmw-datastores', 'vmw-ds-clusters', 'vmw-vms', 'vmw-networks', 'vmw-templates',
- 'validate-yaml', 'validate-storage', 'validate-iface', 'validate-dns',
+ 'vmw-clusters', 'vmw-datastores', 'vmw-ds-clusters', 'vmw-vms', 'vmw-networks',
+ 'vmw-templates', 'validate-yaml', 'validate-storage', 'validate-iface', 'validate-dns',
'perform-dns', 'project-dir', 'tf-files', 'ensure-vmw-folders',
)
step_desc = {
from ..xlate import XLATOR
-__version__ = '0.5.3'
+__version__ = '0.5.4'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
}}
''').format(
- cid=self.config.vsphere_tag_cat_os_id,
- cname=self.config.vsphere_tag_cat_os_name,
- cdesc=self.config.vsphere_tag_cat_os_desc,
- tid=self.config.vsphere_tag_os_rhel_id,
- tname=self.config.vsphere_tag_os_rhel_name,
- tdesc=self.config.vsphere_tag_os_rhel_desc,
- )
+ cid=self.config.vsphere_tag_cat_os_id,
+ cname=self.config.vsphere_tag_cat_os_name,
+ cdesc=self.config.vsphere_tag_cat_os_desc,
+ tid=self.config.vsphere_tag_os_rhel_id,
+ tname=self.config.vsphere_tag_os_rhel_name,
+ tdesc=self.config.vsphere_tag_os_rhel_desc,
+ )
content += tpl
-
if self.simulate:
if self.verbose:
print(content)
content += self._only_update_packages(vm)
# ## Unregistring from RedHat Subscription Management
- cmd = ('if [ -x /sbin/subscription-manager ] ; then '
- '/sbin/subscription-manager unregister --no-progress-messages; fi || true')
+ cmd = (
+ 'if [ -x /sbin/subscription-manager ] ; then '
+ '/sbin/subscription-manager unregister --no-progress-messages; fi || true')
if vm.is_rhel:
content += ' provisioner "remote-exec" {\n'
content += ' inline = [\n'
command_list.append("/tmp/update-networkmanager -v")
command_list.append("rm -fv /tmp/update-networkmanager")
command_list.append("rm -fv /tmp/functions.rc")
- commands=',\n '.join(map( lambda x: '"' + x + '"', command_list))
+ commands = ',\n '.join(map(lambda x: '"' + x + '"', command_list))
content = textwrap.indent(textwrap.dedent('''\
provisioner "local-exec" {{
command_list.append("/tmp/update-networkmanager -v")
command_list.append("rm -fv /tmp/update-networkmanager")
command_list.append("rm -fv /tmp/functions.rc")
- commands=',\n '.join(map( lambda x: '"' + x + '"', command_list))
+ commands = ',\n '.join(map(lambda x: '"' + x + '"', command_list))
content = textwrap.indent(textwrap.dedent('''\
provisioner "remote-exec" {{
from ..xlate import XLATOR
-__version__ = '0.2.1'
+__version__ = '0.2.2'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
}
show_params = copy.copy(params)
+ vs_port = self.config.vsphere[vsphere_name].port
+ vs_host = self.config.vsphere[vsphere_name].host
+ vs_dc = self.config.vsphere[vsphere_name].dc
+
connect_info = VSPhereConfigInfo(
appname=self.appname, verbose=self.verbose, base_dir=self.base_dir,
- host=self.config.vsphere[vsphere_name].host, port=self.config.vsphere[vsphere_name].port,
- dc=self.config.vsphere[vsphere_name].dc, user=self.vsphere_user,
+ host=vs_host, port=vs_port, dc=vs_dc, user=self.vsphere_user,
password=self.vsphere_password, initialized=True)
params['connect_info'] = connect_info
self.incr_verbosity()
for vsphere_name in self.vsphere:
- LOG.debug(_("Searching for datastore clusters in VSPhere {!r} ...").format(vsphere_name))
+ LOG.debug(_("Searching for datastore clusters in VSPhere {!r} ...").format(
+ vsphere_name))
self.vsphere[vsphere_name].get_ds_clusters()
nr_total += len(self.vsphere[vsphere_name].ds_clusters.keys())
msg += "\n" + pp(self.config.vsphere[vsphere_name].used_templates)
LOG.debug(msg)
- found_template = False
for template_name in self.config.vsphere[vsphere_name].used_templates:
if template_name in self.vsphere_templates[vsphere_name]:
LOG.debug(_("Searching for template {t!r} in VSPhere {v!r} ...").format(
t=template_name, v=vsphere_name))
re_vm = re.compile(r'^' + re.escape(template_name) + r'$', re.IGNORECASE)
- vm_list = self.vsphere[vsphere_name].get_vms(re_vm, as_obj=True, stop_at_found=True)
+ vm_list = self.vsphere[vsphere_name].get_vms(
+ re_vm, as_obj=True, stop_at_found=True)
if vm_list:
vm = vm_list[0]
tname = vm.name.lower()
for vsphere_name in self.vsphere_templates:
out_dict[vsphere_name] = {}
for tname in self.vsphere_templates[vsphere_name]:
- out_dict[vsphere_name][tname] = self.vsphere_templates[vsphere_name][tname].as_dict()
+ t_dict = self.vsphere_templates[vsphere_name][tname].as_dict()
+ out_dict[vsphere_name][tname] = t_dict
msg += "\n" + pp(out_dict)
LOG.debug(msg)
from .xlate import XLATOR
-__version__ = '0.1.0'
+__version__ = '0.1.1'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
return True
+
# =============================================================================
if __name__ == '__main__':
from ..config import CrTfConfiguration
from ..errors import TerraformVmDefinitionError
-from ..errors import TerraformVmTooManyDisksError
+# from ..errors import TerraformVmTooManyDisksError
from ..xlate import XLATOR
-__version__ = '1.3.0'
+__version__ = '1.3.1'
LOG = logging.getLogger(__name__)
A dictionary containing TerraformDisk objects.
It works like a dict.
i.e.:
- * disks = TerraformDiskDict(TerraformDisk(name='disk0',unit_number=0, root=True, size_gb=48, ...))
+ * disks = TerraformDiskDict(TerraformDisk(
+ name='disk0',unit_number=0, root=True, size_gb=48, ...))
* disks[0] returns the first TerraformDisk object in the list of sorted disk names
* disks['disk0'] returns the TerraformDisk object with the name 'disk0'.
"""
if disk.name != key:
msg = self.msg_key_not_name.format(k=key, n=disk.name)
+ raise KeyError(msg)
self._map[key] = disk
raise TypeError(self.msg_invalid_disk_type.format(default.__class__.__name__))
if key in self._map:
- return self._map[unit_number]
+ return self._map[key]
self._set_item(key, default)
return default
from .interface import TerraformInterface
-__version__ = '1.7.1'
+__version__ = '1.7.2'
LOG = logging.getLogger(__name__)
# -------------------------------------------------------------------------
@classmethod
- def _apply_vmdef2vm(cls, vm, key, value, verbose=0, appname=None, base_dir=None):
+ def _apply_vmdef2vm( # noqa: C901
+ cls, vm, key, value, verbose=0, appname=None, base_dir=None):
if verbose > 3:
LOG.debug(_("Evaluating key {k!r}: {v}").format(k=key, v=value))
# -------------------------------------------------------------------------
@classmethod
- def _apply_puppet_vmdef2vm(cls, vm, key, value, verbose=0):
+ def _apply_puppet_vmdef2vm(cls, vm, key, value, verbose=0): # noqa: C901
if key.lower() == 'puppet' and isinstance(value, Mapping):
for (p_key, p_value) in value.items():