Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kevin Lyda
zone2gandi
Commits
d8fa68ad
Commit
d8fa68ad
authored
Jan 20, 2017
by
Kevin Lyda
💬
Browse files
pep8 changes.
parent
cac79d7e
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
d8fa68ad
...
...
@@ -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.ini
0 → 100644
View file @
d8fa68ad
[tox]
envlist
=
py27
[pep8]
zone2gandi/__main__.py
View file @
d8fa68ad
...
...
@@ -2,7 +2,7 @@
# vi: set shiftwidth=4 expandtab:
# :indentSize=4:noTabs=true:
"""zone2gandi.__main__: called when zone2gandi dir
ectory
is called as script."""
"""zone2gandi.__main__: called when zone2gandi dir is called as
a
script."""
from
.zone2gandi
import
main
main
()
zone2gandi/bootstrap.py
deleted
100644 → 0
View file @
cac79d7e
# 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
zone2gandi/zone2gandi.py
View file @
d8fa68ad
...
...
@@ -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
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment