from .xlate import XLATOR
-__version__ = '1.9.1'
+__version__ = '1.10.1'
LOG = logging.getLogger(__name__)
_ = XLATOR.gettext
default_pdns_api_path_prefix = DEFAULT_PDNS_API_PREFIX
default_pdns_api_timeout = DEFAULT_PDNS_API_PORT
default_pdns_comment_account = 'provisioning'
+ default_pdns_notifies_per_zone = 5
+ default_pdns_notify_wait = 1.0
default_rhsm_user = 'dpx-subscriber'
self._pdns_api_use_https = self.default_pdns_api_use_https
self._pdns_api_timeout = self.default_pdns_api_timeout
self.pdns_api_path_prefix = self.default_pdns_api_path_prefix
+ self._pdns_notifies_per_zone = self.default_pdns_notifies_per_zone
+ self._pdns_notify_wait = self.default_pdns_notify_wait
+
self.min_root_size_gb = self.default_min_root_size_gb
self._vm_root_password = None
self.tz_name = self.default_tz_name
raise ValueError(msg)
self._pdns_api_timeout = val
+ # -----------------------------------------------------------
+ @property
+ def pdns_notifies_per_zone(self):
+ """Define, how many notifications should be sent after changing a DNS zone."""
+ return self._pdns_notifies_per_zone
+
+ @pdns_notifies_per_zone.setter
+ def pdns_notifies_per_zone(self, value):
+ if value is None:
+ self._pdns_notifies_per_zone = self.default_pdns_notifies_per_zone
+ return
+ val = int(value)
+ err_msg = _("Invalid number {!r} of DNS zone notifications given, must be > 0.")
+ if val <= 0:
+ raise ValueError(err_msg.format(value))
+ self._pdns_notifies_per_zone = val
+
+ # -----------------------------------------------------------
+ @property
+ def pdns_notify_wait(self):
+ """Define, how many notifications should be sent after changing a DNS zone."""
+ return self._pdns_notify_wait
+
+ @pdns_notify_wait.setter
+ def pdns_notify_wait(self, value):
+ if value is None:
+ self._pdns_notify_wait = self.default_pdns_notify_wait
+ return
+ val = float(value)
+ err_msg = _(
+ "Invalid notification interval {t!r} for zone notifications given, must be > 0.")
+ if val <= 0:
+ raise ValueError(err_msg.format(value))
+ self._pdns_notify_wait = val
+
# -----------------------------------------------------------
@property
def vsphere_tag_cat_os_id(self):
res = super(CrTfConfiguration, self).as_dict(short=short)
- res['simulate'] = self.simulate
+ res['disk_max_size'] = self.disk_max_size
+ res['disk_min_size'] = self.disk_min_size
+ res['disk_size'] = self.disk_size
res['no_pdns'] = self.no_pdns
- res['pdns_api_use_https'] = self.pdns_api_use_https
- res['pdns_api_timeout'] = self.pdns_api_timeout
- res['vm_root_password'] = None
res['pdns_api_key'] = None
- res['disk_size'] = self.disk_size
- res['disk_min_size'] = self.disk_min_size
- res['disk_max_size'] = self.disk_max_size
- res['root_min_size'] = self.root_min_size
- res['root_max_size'] = self.root_max_size
+ res['pdns_api_timeout'] = self.pdns_api_timeout
+ res['pdns_api_use_https'] = self.pdns_api_use_https
+ res['pdns_notifies_per_zone'] = self.pdns_api_timeout
+ res['pdns_notify_wait'] = self.pdns_api_timeout
res['rhsm_user'] = self.rhsm_user
+ res['root_max_size'] = self.root_max_size
+ res['root_min_size'] = self.root_min_size
+ res['simulate'] = self.simulate
+ res['vm_root_password'] = None
+ res['vsphere_tag_cat_os_desc'] = self.vsphere_tag_cat_os_desc
res['vsphere_tag_cat_os_id'] = self.vsphere_tag_cat_os_id
res['vsphere_tag_cat_os_name'] = self.vsphere_tag_cat_os_name
- res['vsphere_tag_cat_os_desc'] = self.vsphere_tag_cat_os_desc
+ res['vsphere_tag_os_rhel_desc'] = self.vsphere_tag_os_rhel_desc
res['vsphere_tag_os_rhel_id'] = self.vsphere_tag_os_rhel_id
res['vsphere_tag_os_rhel_name'] = self.vsphere_tag_os_rhel_name
- res['vsphere_tag_os_rhel_desc'] = self.vsphere_tag_os_rhel_desc
res['vsphere'] = {}
for vsphere_name in self.vsphere.keys():
re_use_https = re.compile(r'^\s*(?:api[-_\.]?)?(?:use[-_\.]?)?https\s*$', re.IGNORECASE)
re_prefix = re.compile(r'^\s*(?:api[-_\.]?)?(?:path[-_\.]?)?prefix\s*$', re.IGNORECASE)
re_comment_account = re.compile(r'^\s*comment[-_\.]?account\s*$', re.IGNORECASE)
+ re_notifies_per_zone = re.compile(
+ r'^\s*notifies(?:(?:[-_\.]?per)?[-_\.]?zone)?\s*$', re.IGNORECASE)
+ re_notify_wait = re.compile(r'^\s*notify[-_\.]?(wait|sleep)\s*$', re.IGNORECASE)
for (key, value) in config.items(section):
if re_master.search(key) and value.strip():
self.pdns_api_timeout = value.strip()
elif re_comment_account.search(key) and value.strip():
self.pdns_comment_account = value.strip()
+ elif re_notifies_per_zone.search(key):
+ try:
+ self.pdns_notifies_per_zone = value
+ except ValueError as e:
+ raise CrTfConfigError(self.msg_invalid_type.format(
+ f=self.config_file, s=section, v=value, n=key, e=e))
+ elif re_notify_wait.search(key):
+ try:
+ self.pdns_notify_wait = value
+ except ValueError as e:
+ raise CrTfConfigError(self.msg_invalid_type.format(
+ f=self.config_file, s=section, v=value, n=key, e=e))
return