Commit d8fa68ad authored by Kevin Lyda's avatar Kevin Lyda 💬
Browse files

pep8 changes.

parent cac79d7e
......@@ -9,8 +9,10 @@ test:2.7:
script:
- apk update && apk add git
- pip install pytest-cov
- pip install pep8
- python setup.py install
- python setup.py test
- pep8 zone2gandi-runner.py zone2gandi/*.py
# - py.test --cov=zone2gandi tests
test:3.3:
......
[tox]
envlist = py27
[pep8]
......@@ -2,7 +2,7 @@
# vi: set shiftwidth=4 expandtab:
# :indentSize=4:noTabs=true:
"""zone2gandi.__main__: called when zone2gandi directory is called as script."""
"""zone2gandi.__main__: called when zone2gandi dir is called as a script."""
from .zone2gandi import main
main()
# c-basic-offset: 4; indent-tabs-mode: nil
# vi: set shiftwidth=4 expandtab:
# :indentSize=4:noTabs=true:
"""zone2gandi.zone2gandi: provides entry point main()."""
__version__ = "0.1.0"
import sys
from .stuff import Stuff
def main():
print("Executing bootstrap version %s." % __version__)
print("List of argument strings: %s" % sys.argv[1:])
print("Stuff and Boo():\n%s\n%s" % (Stuff, Boo()))
class Boo(Stuff):
pass
......@@ -11,30 +11,31 @@ import xmlrpclib
__version__ = "0.1.1"
def main():
try:
config = yaml.safe_load(open('config', 'r').read())
except:
print('Create config like "config.sample".')
sys.exit(1)
apiendpoint = config['apiendpoint']
apikey = config['apikey']
try:
config = yaml.safe_load(open('config', 'r').read())
except:
print('Create config like "config.sample".')
sys.exit(1)
apiendpoint = config['apiendpoint']
apikey = config['apikey']
api = xmlrpclib.ServerProxy(apiendpoint)
gzones = api.domain.zone.list(apikey)
for zonepath in sys.argv[1:]:
with open(zonepath, 'r') as zonefd:
zone = zonefd.read()
zonefile = zonepath[zonepath.rfind('/') + 1:]
gzone = {}
for gzone_needle in gzones:
if gzone_needle['name'] == zonefile:
gzone = gzone_needle
break
if not gzone:
gzone = api.domain.zone.create(apikey, { 'name': zonefile })
version = api.domain.zone.version.new(apikey, gzone['id'])
api.domain.zone.record.set(apikey, gzone['id'], version, zone)
api.domain.zone.version.set(apikey, gzone['id'], version)
api.domain.zone.version.delete(apikey, gzone['id'], gzone['version'])
print('Zonefile %s updated (gandi version %d)' % (zonefile, version))
api = xmlrpclib.ServerProxy(apiendpoint)
gzones = api.domain.zone.list(apikey)
for zonepath in sys.argv[1:]:
with open(zonepath, 'r') as zonefd:
zone = zonefd.read()
zonefile = zonepath[zonepath.rfind('/') + 1:]
gzone = {}
for gzone_needle in gzones:
if gzone_needle['name'] == zonefile:
gzone = gzone_needle
break
if not gzone:
gzone = api.domain.zone.create(apikey, {'name': zonefile})
version = api.domain.zone.version.new(apikey, gzone['id'])
api.domain.zone.record.set(apikey, gzone['id'], version, zone)
api.domain.zone.version.set(apikey, gzone['id'], version)
api.domain.zone.version.delete(apikey, gzone['id'], gzone['version'])
print('Zonefile %s updated (gandi version %d)' % (zonefile, version))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment