if os.path.exists(module_dir):
sys.path.insert(0, base_dir)
-from pp_lib.config_named_app import PpConfigNamedApp
+#from pp_lib.config_named_app import PpConfigNamedApp
+from pp_lib.deploy_zones_from_pdns import PpDeployZonesApp
log = logging.getLogger(__name__)
locale.setlocale(locale.LC_ALL, '')
-app = PpConfigNamedApp(appname=appname)
+app = PpDeployZonesApp(appname=appname, base_dir=base_dir)
app.initialized = True
if app.verbose > 2:
from .common import pp, compare_fqdn, to_str
from .common import RE_DOT_AT_END
-from .pdns_app import PpPDNSAppError, PpPDNSApplication, PDNSApiNotFoundError, PDNSApiValidationError
+from .pdns_app import PpPDNSAppError, PpPDNSApplication
+from .pdns_app import PDNSApiNotFoundError, PDNSApiValidationError
from .pdns_zone import PdnsApiZone
from .pdns_record import compare_rrsets
-__version__ = '0.1.1'
+__version__ = '0.1.2'
LOG = logging.getLogger(__name__)
"""
# -------------------------------------------------------------------------
- def __init__(self, appname=None, version=__version__):
+ def __init__(self, appname=None, base_dir=None, version=__version__):
self.zones = []
description = textwrap.dedent('''\
- Lists all available zones from given PowerDNS API.
+ Generation of the BIND9 configuration file for slave zones.
''')
- super(PpPDNSShowZoneApp, self).__init__(
+ super(PpDeployZonesApp, self).__init__(
appname=appname, version=version, description=description,
+ base_dir=base_dir, cfg_stems='dns-deploy-zones', environment="public",
)
self.initialized = True
-
# =============================================================================
from .cfg_app import PpCfgAppError, PpConfigApplication
-__version__ = '0.2.1'
+__version__ = '0.2.2'
LOG = logging.getLogger(__name__)
_LIBRARY_NAME = "pp-pdns-api-client"
self, appname=None, verbose=0, version=__version__, base_dir=None,
initialized=None, usage=None, description=None,
argparse_epilog=None, argparse_prefix_chars='-', env_prefix=None,
- cfg_dir=None, cfg_stems=None, cfg_encoding='utf-8', need_config_file=False):
+ cfg_dir=None, cfg_stems=None, cfg_encoding='utf-8', need_config_file=False,
+ environment='global'):
self._api_key = self.api_keys['global']
self._api_host = self.api_hosts['global']
)
self._user_agent = '{}/{}'.format(_LIBRARY_NAME, self.version)
+ if environment != 'global':
+ self.environment = environment
# -----------------------------------------------------------
@property
import datetime
import json
-from json import JSONDecodeError
-
# Third party modules
# Own modules
from .errors import PpError
from .obj import PpBaseObjectError, PpBaseObject
-__version__ = '0.3.1'
+__version__ = '0.3.2'
LOG = logging.getLogger(__name__)
mtime.isoformat(' '), cmt['account'], cmt['content'])
else:
line = "; {} {}\n".format(mtime.isoformat(' '), cmt['account'])
- except JSONDecodeError as e:
+ except Exception as e:
LOG.warn("Could not decode comment {!r}: {}".format(comment, e))
line = '; {}\n'.format(comment)