From a2eaebeee3d6d450e58b1a292f2d886d7ba18d51 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Tue, 1 Oct 2019 10:32:21 +0200 Subject: [PATCH] Removing configuration parameters relative_tf_dir and terraform_dir --- lib/cr_tf/config.py | 54 ++------------------------------------------- 1 file changed, 2 insertions(+), 52 deletions(-) diff --git a/lib/cr_tf/config.py b/lib/cr_tf/config.py index cef748d..95dc806 100644 --- a/lib/cr_tf/config.py +++ b/lib/cr_tf/config.py @@ -34,7 +34,7 @@ from .errors import CrTfConfigError from .xlate import XLATOR -__version__ = '1.3.2' +__version__ = '1.3.3' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -420,7 +420,6 @@ class CrTfConfiguration(BaseConfiguration): default_pdns_api_timeout = DEFAULT_PDNS_API_PORT default_pdns_comment_account = 'provisioning' default_min_root_size_gb = 32.0 - default_terraform_dir = Path('terraform') default_tz_name = 'Europe/Berlin' default_guest_id = "oracleLinux7_64Guest" @@ -456,8 +455,6 @@ class CrTfConfiguration(BaseConfiguration): self._pdns_api_timeout = self.default_pdns_api_timeout self.pdns_api_path_prefix = self.default_pdns_api_path_prefix self.min_root_size_gb = self.default_min_root_size_gb - self._relative_tf_dir = True - self._terraform_dir = self.default_terraform_dir self._vm_root_password = None self.tz_name = self.default_tz_name self.guest_id = self.default_guest_id @@ -487,8 +484,6 @@ class CrTfConfiguration(BaseConfiguration): encoding=encoding, config_dir=config_dir, config_file=config_file, initialized=False, ) - self.terraform_dir = self.default_terraform_dir - self.simulate = simulate if initialized: @@ -551,39 +546,6 @@ class CrTfConfiguration(BaseConfiguration): raise ValueError(msg) self._pdns_api_timeout = val - # ----------------------------------------------------------- - @property - def relative_tf_dir(self): - """Use a project directory relative to the definition YAML file instead - of the standard terraform directory. - By this way it is possible to use project direectories - outside this GIT repository.""" - return self._relative_tf_dir - - @relative_tf_dir.setter - def relative_tf_dir(self, value): - self._relative_tf_dir = to_bool(value) - - # ----------------------------------------------------------- - @property - def terraform_dir(self): - """The directory, where the terraform project directories should be created. - It is not used, if relative_tf_dir was set to True (the default).""" - return self._terraform_dir - - @terraform_dir.setter - def terraform_dir(self, value): - - if not value: - return - - val = Path(str(value)) - if val.is_absolute(): - self._terraform_dir = val.resolve() - return - - self._terraform_dir = self.base_dir.joinpath(val).resolve() - # ----------------------------------------------------------- @property def vm_root_password(self): @@ -705,8 +667,6 @@ class CrTfConfiguration(BaseConfiguration): res['pdns_api_timeout'] = self.pdns_api_timeout res['vm_root_password'] = None res['pdns_api_key'] = None - res['relative_tf_dir'] = self.relative_tf_dir - res['terraform_dir'] = self.terraform_dir res['disk_size'] = self.disk_size res['disk_min_size'] = self.disk_min_size res['disk_max_size'] = self.disk_max_size @@ -903,7 +863,6 @@ class CrTfConfiguration(BaseConfiguration): if self.verbose > 2: LOG.debug(_("Checking config section {!r} ...").format(section)) - re_dir = re.compile(r'^\s*dir(?:ectory)?\s*$', re.IGNORECASE) re_root_pw = re.compile(r'^\s*root[_-]?passw(?:ord)?\s*$', re.IGNORECASE) re_disk_size = re.compile(r'^\s*(?:data[_-]?)?disk[_-]?size\s*$', re.IGNORECASE) @@ -916,22 +875,13 @@ class CrTfConfiguration(BaseConfiguration): r'^\s*root[_-]?disk[_-]?min[_-]?size\s*$', re.IGNORECASE) re_root_disk_max_size = re.compile( r'^\s*root[_-]?disk[_-]?max[_-]?size\s*$', re.IGNORECASE) - re_relative_tf_dir = re.compile( - r'^\s*(?:use[_-]?)?relative[_-]?(?:tf|terraform)?[_-]?dir(?:ectory)?\s*$', - re.IGNORECASE) re_backend_host = re.compile(r'^\s*backend[_-]?host\s*$', re.IGNORECASE) re_backend_scheme = re.compile(r'^\s*backend[_-]?scheme\s*$', re.IGNORECASE) re_backend_path_prefix = re.compile(r'^\s*backend[_-]?path[_-]?prefix\s*$', re.IGNORECASE) for (key, value) in config.items(section): - if re_dir.search(key) and value.strip(): - self.terraform_dir = value.strip() - elif re_relative_tf_dir.search(key): - if value is not None and str(value).strip() != '': - self.relative_tf_dir = value - # else: default is True - elif re_root_pw.search(key) and value.strip(): + if re_root_pw.search(key) and value.strip(): self.vm_root_password = value elif re_disk_size.search(key): self.disk_size = value -- 2.39.5