import six
from six import reraise
import requests
+from pytz import timezone, UnknownTimeZoneError
from six.moves.urllib.parse import urlunsplit
from .pidfile import PidFileError, InvalidPidFileError, PidFileInUseError, PidFile
-__version__ = '0.5.2'
+__version__ = '0.5.3'
LOG = logging.getLogger(__name__)
super(PpDeployZonesApp, self).post_init()
self.initialized = False
+ if not self.quiet:
+ print('')
+
LOG.debug("Post init phase.")
LOG.debug("Checking for masters, which are local addresses ...")
"Address {!r} not in list of local addresses.".format(addr))
ext_masters.append(addr)
self.zone_masters = ext_masters
- LOG.info("Using list of masters for slave zones:\n{}".format(pp(self.zone_masters)))
+ LOG.info("Using masters for slave zones: {}".format(
+ ', '.join(map(lambda x: '{!r}'.format(x), self.zone_masters))))
self.pidfile = PidFile(
filename=self.pidfile_name, appname=self.appname, verbose=self.verbose,
# -------------------------------------------------------------------------
def _run(self):
+ local_tz_name = 'Europe/Berlin'
+ if 'TZ' in os.environ and os.environ['TZ']:
+ local_tz_name = os.environ['TZ']
+ try:
+ local_tz = timezone(local_tz_name)
+ except UnknownTimeZoneError:
+ LOG.error("Unknown time zone: {!r}.".format(local_tz_name))
+ self.exit(6)
+
my_uid = os.geteuid()
if my_uid:
msg = "You must be root to execute this script."
try:
- LOG.info("Here we go again ...")
+ LOG.info("Starting: {}".format(
+ datetime.datetime.now(local_tz).strftime('%Y-%m-%d %H:%M:%S %Z')))
self.zones = self.get_api_zones()
self.zones.sort(key=lambda x: cmp_to_key(compare_fqdn)(x.name_unicode))
finally:
self.cleanup()
self.pidfile = None
+ LOG.info("Ending: {}".format(
+ datetime.datetime.now(local_tz).strftime('%Y-%m-%d %H:%M:%S %Z')))
# -------------------------------------------------------------------------
def cleanup(self):