Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
Nico Schottelius 2019-05-12 12:22:14 +02:00
parent 44a846a646
commit cf21ec33a9
2 changed files with 7 additions and 13 deletions

View file

@ -2,6 +2,10 @@
A python package to set reverse dns in ungleich vm. A python package to set reverse dns in ungleich vm.
## Requirements
You need at least python 3.
## Usage ## Usage
installing the package via pip (python3 required) installing the package via pip (python3 required)

View file

@ -41,19 +41,9 @@ class ungleichRIPE(object):
ripe_object['descr'] = args.description ripe_object['descr'] = args.description
ripe_object['mnt-by'] = "mnt-ungleich" ripe_object['mnt-by'] = "mnt-ungleich"
# ripe_attributes = []
ripe_attributes = [{ "name": key, "value": value } for key, value in ripe_object.items() ] ripe_attributes = [{ "name": key, "value": value } for key, value in ripe_object.items() ]
# for key, value in ripe_object.items(): # Format according to API layout
# ripe_attributes.append( { "name": key,
# "value": value
# }
# )
# "source": {
# "id": "RIPE"
# },
ripe_element = {} ripe_element = {}
ripe_element['objects'] = [] ripe_element['objects'] = []
ripe_element['objects'].append( ripe_element['objects'].append(
@ -69,6 +59,8 @@ class ungleichRIPE(object):
) )
data = json.dumps(ripe_element).encode('utf-8') data = json.dumps(ripe_element).encode('utf-8')
# debug
pprint.pprint(ripe_element) pprint.pprint(ripe_element)
method = 'POST' method = 'POST'
@ -81,8 +73,6 @@ class ungleichRIPE(object):
"Accept": "application/json" "Accept": "application/json"
}) })
pprint.pprint(req)
print("Adding a v6 route object at {} for {} with {} req={}".format(url, args.network, data, str(req))) print("Adding a v6 route object at {} for {} with {} req={}".format(url, args.network, data, str(req)))
with urllib.request.urlopen(req) as f: with urllib.request.urlopen(req) as f: