From: Frank Brehm Date: Tue, 19 Jul 2022 12:42:30 +0000 (+0200) Subject: Version bump to 1.6.7 and trying to fix lib/cr_tf/terraform/vm.py X-Git-Tag: 1.6.8~2^2 X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=35aa1eecfb21123d9e8114821d884a5a6f3d30da;p=pixelpark%2Fcreate-terraform.git Version bump to 1.6.7 and trying to fix lib/cr_tf/terraform/vm.py --- diff --git a/lib/cr_tf/__init__.py b/lib/cr_tf/__init__.py index a2a7fb3..09714d5 100644 --- a/lib/cr_tf/__init__.py +++ b/lib/cr_tf/__init__.py @@ -1,7 +1,7 @@ #!/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '1.6.6' +__version__ = '1.6.7' MIN_VERSION_TERRAFORM = '1.0.5' MAX_VERSION_TERRAFORM = '1.3.0' diff --git a/lib/cr_tf/terraform/vm.py b/lib/cr_tf/terraform/vm.py index 4dace59..1744e4a 100644 --- a/lib/cr_tf/terraform/vm.py +++ b/lib/cr_tf/terraform/vm.py @@ -37,7 +37,7 @@ from .disk import TerraformDisk, TerraformDiskDict from .interface import TerraformInterface -__version__ = '1.6.1' +__version__ = '1.6.2' LOG = logging.getLogger(__name__) @@ -492,7 +492,10 @@ class TerraformVm(HandlingObject): k=key, c=value.__class__.__name__)) return False - val_stripped = value.strip() + if isinstance(value, str): + val_stripped = value.strip() + else: + val_stripped = str(value) if cls.re_key_puppet_contact.search(key) and val_stripped: if cls.re_invalid_chars.search(val_stripped): @@ -522,8 +525,8 @@ class TerraformVm(HandlingObject): vm.puppet_role = val_stripped return True - if cls.re_key_puppet_initial_install.search(key) and val_stripped: - vm.puppet_initial_install = val_stripped + if cls.re_key_puppet_initial_install.search(key): + vm.puppet_initial_install = value return True if cls.re_key_puppet_tier.search(key) and val_stripped: @@ -548,7 +551,10 @@ class TerraformVm(HandlingObject): @classmethod def _apply_puppetsub_vmdef2vm(cls, vm, p_key, p_value, verbose=0): - p_value_stripped = p_value.strip() + if isinstance(p_value, str): + p_value_stripped = p_value.strip() + else: + p_value_stripped = str(p_value) if verbose > 2: LOG.debug(_("Evaluating sub key of {d!r}: {k!r} => {v!r}").format( d='puppet', k=p_key, v=p_value_stripped)) @@ -581,9 +587,9 @@ class TerraformVm(HandlingObject): vm.puppet_role = p_value_stripped return - if cls.re_key_initial_install.search(p_key) and p_value_stripped: - vm.puppet_initial_install = p_value_stripped - return True + if cls.re_key_initial_install.search(p_key): + vm.puppet_initial_install = p_value + return if p_key.lower() == 'tier' and p_value_stripped: if cls.re_invalid_chars.search(p_value_stripped):