# $Id$
+# $URL$
import time
from PLC.Faults import *
from PLC.Keys import Key, Keys
from PLC.SliceTags import SliceTag, SliceTags
from PLC.InitScripts import InitScript, InitScripts
-from PLC.Config import Config
-
-# XXX we don't really know whether this PLC is loaded from /etc/planetlab/plc_config or elsewhere
-plc_config = Config()
# XXX used to check if slice expiration time is sane
MAXINT = 2L**31-1
}
def call(self, auth, node_id_or_hostname = None):
- global plc_config
-
timestamp = int(time.time())
# Get node
sites = Sites(self.api, site_filter, site_return_filter)
site = sites[0]
person_filter = {'person_id':site['person_ids'],'enabled':True}
- person_return_filter = ['person_id', 'enabled', 'key_ids','role_ids']
+ person_return_filter = ['person_id', 'enabled', 'key_ids','role_ids','roles']
site_persons = Persons(self.api, person_filter, person_return_filter)
- # XXX This snippet below maps role names to role_ids,
- # which is really DUMB. Why can't one just pass 'roles'
- # as a return_filter to Persons() above.
- __roles = {}
- dbroles = Roles(self.api)
- for dbrole in dbroles:
- __roles[dbrole['name']]=dbrole['role_id']
- __theroles = []
- for role in theroles:
- __theroles.append(__roles[role])
- theroles=__theroles
-
# collect the keys into a table to weed out duplicates
site_keys = {}
for site_person in site_persons:
# 'root' account setup on nodes from all 'admin' users
# registered with the PLC main site
- personsitekeys=getpersonsitekeys(plc_config.PLC_SLICE_PREFIX,['admin'])
+ personsitekeys=getpersonsitekeys(self.api.config.PLC_SLICE_PREFIX,['admin'])
accounts.append({'name':'root','keys':personsitekeys})
node.update_last_contact()