from .pdns_zone import PdnsApiZone
from .pdns_record import compare_rrsets
-__version__ = '0.2.1'
+from .pidfile import PidFileError, InvalidPidFileError, PidFileInUseError, PidFile
+
+__version__ = '0.2.2'
LOG = logging.getLogger(__name__)
def __init__(self, appname=None, base_dir=None, version=__version__):
self.zones = []
+ self.pidfile = None
self._show_simulate_opt = True
base_dir=base_dir, cfg_stems='dns-deploy-zones', environment="public",
)
- self.initialized = True
+ self.post_init()
# -------------------------------------------
@property
else:
LOG.warn("No valid masters found in configuration.")
+ # -------------------------------------------------------------------------
+ def post_init(self):
+
+ super(PpDeployZonesApp, self).post_init()
+ self.initialized = False
+
+ LOG.debug("Post init phase.")
+
+ self.pidfile = PidFile(
+ filename=self.pidfile_name, appname=self.appname, verbose=self.verbose,
+ base_dir=self.base_dir, simulate=self.simulate)
+
+ self.initialized = True
+
# -------------------------------------------------------------------------
def pre_run(self):
"""
"please use 'local' or 'public'")
self.exit(1)
+ # -------------------------------------------------------------------------
+ def _run(self):
+
+ my_uid = os.geteuid()
+ if my_uid:
+ msg = "You must be root to execute this script."
+ if self.simulate:
+ LOG.warn(msg)
+ time.sleep(1)
+ else:
+ LOG.error(msg)
+ self.exit(1)
+ LOG.info("Here we go again ...")
# =============================================================================