fix adding nodes, and the sync target in the process
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 12 Mar 2010 13:30:50 +0000 (13:30 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Fri, 12 Mar 2010 13:30:50 +0000 (13:30 +0000)
Makefile
PLC/Accessors/Accessors_standard.py
PLC/Methods/AddNode.py
PLC/Methods/AddNodeTag.py
db-config.d/010-node_tags

index 390d107..4d16d99 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,7 @@ ifeq (,$(SSHURL))
        @exit 1
 else
        +$(RSYNC) plcsh PLC planetlab5.sql migrations $(SSHURL)/usr/share/plc_api/
+       +$(RSYNC) db-config.d/ $(SSHURL)/etc/planetlab/db-config.d/
        $(SSHCOMMAND) exec apachectl graceful
 endif
 
index 774903c..0d773b2 100644 (file)
@@ -66,10 +66,10 @@ define_accessors(current_module, Node, "Deployment", "deployment",
 define_accessors(current_module, Node, "Extensions", "extensions", 
                  "node/config", "space-separated list of extensions to install",
                  get_roles=all_roles, set_roles=["admin"],expose_in_api=True)
-# access HRN
+# access HRN - this is the ideal definition of roles, even if AddNodeTag cannot handle this 
 define_accessors(current_module, Node, "Hrn","hrn",
                  "node/sfa", "SFA human readable name",
-                 get_roles=all_roles, set_roles=["admin"], expose_in_api=True)
+                 get_roles=all_roles, set_roles=["admin","pi","tech"], expose_in_api=True)
 
 # test nodes perform their installation from an uncompressed bootstrapfs
 define_accessors(current_module, Node, "PlainBootstrapfs", "plain-bootstrapfs", 
index 90cf14f..c787011 100644 (file)
@@ -75,9 +75,6 @@ class AddNode(Method):
 
         # since hostname was specified lets add the 'hrn' node tag
         root_auth = self.api.config.PLC_HRN_ROOT
-        # sub auth is the login base of this node's site
-        sites = Sites(self.api, node['site_id'], ['login_base'])
-        site = sites[0]
         login_base = site['login_base']
         tags['hrn'] = hostname_to_hrn(root_auth, login_base, node['hostname'])        
 
index ac6bbd1..81e46c0 100644 (file)
@@ -78,7 +78,7 @@ class AddNodeTag(Method):
            required_min_role = tag_type ['min_role_id']
            if required_min_role is not None and \
                    min(self.caller['role_ids']) > required_min_role:
-               raise PLCPermissionDenied, "Not allowed to modify the specified node tag, requires role %d",required_min_role
+               raise PLCPermissionDenied, "Not allowed to modify the specified node tag, requires role %d"%required_min_role
 
         node_tag = NodeTag(self.api)
         node_tag['node_id'] = node['node_id']
index c25230d..b0062fc 100644 (file)
@@ -10,7 +10,7 @@ nodetag_types = \
     {'tagname': 'hrn',
      'description': 'SFA human readable name',
      'category' : 'node/sfa',
-     'min_role_id': 10},
+     'min_role_id': 40},
 ]
 
 for nodetag_type in nodetag_types: