Merge branch 'master' into 'master'

Update readme

See merge request ungleich-public/ungleich-cli!1
This commit is contained in:
nico14571 2019-05-12 12:33:23 +02:00
commit 0e47c9f253
2 changed files with 13 additions and 16 deletions

View File

@ -1,8 +1,15 @@
# Ungleich dns cli tool # ungleich cli
A python package to set reverse dns in ungleich vm. This CLI is used for day-to-day tasks used at ungleich.
It is intended to be used by ungleich engineers and skilled customers.
## Usage ## Requirements / Installation
* ensure you have python3
* git clone this repo
* python ungleich-cli.py
## Usage: DNS
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: