case-insensitive hostname lookup
diff --git a/planetstack/tools/get_instance_ip.py b/planetstack/tools/get_instance_ip.py
index c227e2e..b3e4502 100644
--- a/planetstack/tools/get_instance_ip.py
+++ b/planetstack/tools/get_instance_ip.py
@@ -21,8 +21,13 @@
return r.json()[0]["id"]
def get_node_id(host_name):
- r = requests.get(NODES_API + "?name=%s" % host_name, auth=opencloud_auth)
- return r.json()[0]["id"]
+ r = requests.get(NODES_API)
+ nodes = r.json()
+ for node in nodes:
+ if node["name"].lower() == host_name.lower():
+ return node["id"]
+ print >> sys.stderr, "Error: failed to find node %s" % host_name
+ sys.exit(-1)
def get_slivers(slice_id=None, node_id=None):
queries = []
diff --git a/planetstack/tools/get_instance_name.py b/planetstack/tools/get_instance_name.py
index a0b55d2..01fc841 100644
--- a/planetstack/tools/get_instance_name.py
+++ b/planetstack/tools/get_instance_name.py
@@ -18,8 +18,15 @@
return r.json()[0]["id"]
def get_node_id(host_name):
- r = requests.get(NODES_API + "?name=%s" % host_name, auth=opencloud_auth)
- return r.json()[0]["id"]
+# r = requests.get(NODES_API + "?name=%s" % host_name, auth=opencloud_auth)
+# return r.json()[0]["id"]
+ r = requests.get(NODES_API)
+ nodes = r.json()
+ for node in nodes:
+ if node["name"].lower() == host_name.lower():
+ return node["id"]
+ print >> sys.stderr, "Error: failed to find node %s" % host_name
+ sys.exit(-1)
def get_slivers(slice_id=None, node_id=None):
queries = []