from .xlate import XLATOR
-__version__ = '1.3.2'
+__version__ = '1.3.3'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
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"
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
encoding=encoding, config_dir=config_dir, config_file=config_file, initialized=False,
)
- self.terraform_dir = self.default_terraform_dir
-
self.simulate = simulate
if initialized:
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):
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
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)
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