tweaked to work
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 25 Jan 2010 15:30:21 +0000 (15:30 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Mon, 25 Jan 2010 15:30:21 +0000 (15:30 +0000)
Makefile
PLC/Methods/GetNodeFlavour.py

index 04756d9..d2e44b0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -113,12 +113,12 @@ tags:
 # (*) otherwise, entering through the root context
 # make sync PLCHOST=testbox1.inria.fr GUEST=vplc03.inria.fr
 
+PLCHOST ?= testplc.onelab.eu
+
 ifdef GUEST
-ifdef PLCHOST
 SSHURL:=root@$(PLCHOST):/vservers/$(GUEST)
 SSHCOMMAND:=ssh root@$(PLCHOST) vserver $(GUEST)
 endif
-endif
 ifdef PLC
 SSHURL:=root@$(PLC):/
 SSHCOMMAND:=ssh root@$(PLC)
index bcc60ca..8c3489f 100644 (file)
@@ -25,7 +25,7 @@ class GetNodeFlavour(Method):
     accepts = [
         Auth(),
         Mixed(Node.fields['node_id'],
-              Node.fields['name']),
+              Node.fields['hostname']),
         ]
 
     returns = { 'nodefamily' : Parameter (str, "the node-family this node should be based upon"),
@@ -35,7 +35,7 @@ class GetNodeFlavour(Method):
 
     
     ########## nodefamily
-    def nodefamily (self, auth, nodeid):
+    def nodefamily (self, auth, node_id):
 
         # the deployment tag, if set, wins
         deployment = GetNodeDeployment (self.api).call(auth,node_id)
@@ -55,10 +55,13 @@ class GetNodeFlavour(Method):
         return "%s-%s"%(pldistro,arch)
 
     def extensions (self, auth, node_id):
-        return GetNodeExtensions(self.api).call(auth,node_id).split()
+        try:
+            return GetNodeExtensions(self.api).call(auth,node_id).split()
+        except:
+            return []
 
     def compressed (self, auth, node_id):
-        return not PlainBootstrapfs(self.api).call(auth,node_id)
+        return not not not GetNodePlainBootstrapfs(self.api).call(auth,node_id)
 
     def call(self, auth, node_id_or_name):
         # Get node information
@@ -68,6 +71,7 @@ class GetNodeFlavour(Method):
         node = nodes[0]
         node_id = node['node_id']
 
+        # xxx could use some sanity checking, and could provide fallbacks
         return { 'nodefamily' : self.nodefamily(auth,node_id),
                  'extensions' : self.extensions(auth,node_id),
                  'compressed' : self.compressed(auth,node_id),