From 803f88db9d36dd571ca08d53a33b6fc475e5a69e Mon Sep 17 00:00:00 2001 From: Tony Mack Date: Fri, 1 May 2009 01:18:16 +0000 Subject: [PATCH] added path to python --- geni/gimport.py | 71 ++++++++++++++++++++++------------------ geni/methods/__init__.py | 1 + geni/restart-plc.py | 12 ------- 3 files changed, 41 insertions(+), 43 deletions(-) delete mode 100755 geni/restart-plc.py diff --git a/geni/gimport.py b/geni/gimport.py index ef6534c2..1d273a7b 100755 --- a/geni/gimport.py +++ b/geni/gimport.py @@ -1,3 +1,6 @@ +#!/bin/bash/python +# +# ## # Import PLC records into the Geni database. It is indended that this tool be # run once to create Geni records that reflect the current state of the @@ -188,7 +191,9 @@ def import_person(parent_hrn, person): person_record = table.resolve("user", hrn) if not person_record: - key_ids = person["key_ids"] + key_ids = [] + if 'key_ids' in person: + key_ids = person["key_ids"] if key_ids: # get the user's private key from the SSH keys they have uploaded @@ -209,14 +214,15 @@ def import_person(parent_hrn, person): report.trace(" inserting user record for " + hrn) table.insert(person_record) else: - key_ids = person["key_ids"] - if key_ids: - pkey = get_pl_pubkey(key_ids[0]) - person_gid = AuthHierarchy.create_gid(hrn, create_uuid(), pkey) - person_record = GeniRecord(name=hrn, gid=person_gid, type="user", pointer=person['person_id']) - report.trace(" updating user record for " + hrn) - table.update(person_record) - + key_ids = person["key_ids"] + + if key_ids: + pkey = get_pl_pubkey(key_ids[0]) + person_gid = AuthHierarchy.create_gid(hrn, create_uuid(), pkey) + person_record = GeniRecord(name=hrn, gid=person_gid, type="user", pointer=person['person_id']) + report.trace(" updating user record for " + hrn) + table.update(person_record) + def import_slice(parent_hrn, slice): AuthHierarchy = Hierarchy() slicename = slice['name'].split("_",1)[-1] @@ -289,33 +295,36 @@ def import_site(parent_hrn, site): report.trace(" inserting authority record for " + hrn) table.insert(auth_record) - for person_id in site['person_ids']: - persons = shell.GetPersons(pl_auth, [person_id]) - if persons: - try: - import_person(hrn, persons[0]) - except: - report.trace("Failed to import: %s" % persons[0]) - for slice_id in site['slice_ids']: - slices = shell.GetSlices(pl_auth, [slice_id]) - if slices: - try: - import_slice(hrn, slices[0]) - except: - report.trace("Failed to import: %s" % slices[0]) - for node_id in site['node_ids']: - nodes = shell.GetNodes(pl_auth, [node_id]) - if nodes: - try: - import_node(hrn, nodes[0]) - except: - report.trace("Failed to import: %s" % nodes[0]) + if 'person_ids' in site: + for person_id in site['person_ids']: + persons = shell.GetPersons(pl_auth, [person_id]) + if persons: + try: + import_person(hrn, persons[0]) + except: + report.trace("Failed to import: %s" % persons[0]) + if 'slice_ids' in site: + for slice_id in site['slice_ids']: + slices = shell.GetSlices(pl_auth, [slice_id]) + if slices: + try: + import_slice(hrn, slices[0]) + except: + report.trace("Failed to import: %s" % slices[0]) + if 'node_ids' in site: + for node_id in site['node_ids']: + nodes = shell.GetNodes(pl_auth, [node_id]) + if nodes: + try: + import_node(hrn, nodes[0]) + except: + report.trace("Failed to import: %s" % nodes[0]) def create_top_level_auth_records(hrn): parent_hrn = get_authority(hrn) print hrn, ":", parent_hrn if not parent_hrn: - parent_hrn = hrn + parent_hrn = hrn auth_info = AuthHierarchy.get_auth_info(parent_hrn) table = get_auth_table(parent_hrn) diff --git a/geni/methods/__init__.py b/geni/methods/__init__.py index 6cde05eb..8f1c288b 100644 --- a/geni/methods/__init__.py +++ b/geni/methods/__init__.py @@ -11,6 +11,7 @@ reset_slice resolve get_resources get_slices +get_aggregates start_slice stop_slice update diff --git a/geni/restart-plc.py b/geni/restart-plc.py deleted file mode 100755 index b33a3814..00000000 --- a/geni/restart-plc.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -for i in `ps aux |grep "python plc.py" | head -n3 |awk '{print $2}'` ; do - echo "killing $i" - kill $i -done - -echo "Start Registry" -python plc.py -r -d -echo "Start Aggregate Manager" -python plc.py -a -d -echo "Start Slice Manager" -python plc.py -s -d -- 2.43.0