fix bug in selection of special account ssh keys
[plcapi.git] / PLC / Methods / GetSlivers.py
index b8743cc..d4dbba8 100644 (file)
@@ -1,4 +1,5 @@
 # $Id$
+# $URL$
 import time
 
 from PLC.Faults import *
@@ -17,10 +18,6 @@ from PLC.Roles import Roles
 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
@@ -168,8 +165,6 @@ class v43GetSlivers(Method):
     }
 
     def call(self, auth, node_id_or_hostname = None):
-        global plc_config
-
         timestamp = int(time.time())
 
         # Get node
@@ -257,9 +252,8 @@ class v43GetSlivers(Method):
             site_keys = {}
             for site_person in site_persons:
                 if site_person['enabled'] is False: continue
-                more = True
                 for role in theroles:
-                    if role in site_person['role_ids']:
+                    if role in site_person['roles']:
                         keys_filter = site_person['key_ids']
                         keys_return_filter = ['key_id', 'key', 'key_type']
                         keys = Keys(self.api, keys_filter, keys_return_filter)
@@ -274,7 +268,7 @@ class v43GetSlivers(Method):
 
         # '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()