From d25787ab5419aae9b6070b61eaead9f8dd421c40 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 12 Mar 2010 13:30:50 +0000 Subject: [PATCH] fix adding nodes, and the sync target in the process --- Makefile | 1 + PLC/Accessors/Accessors_standard.py | 4 ++-- PLC/Methods/AddNode.py | 3 --- PLC/Methods/AddNodeTag.py | 2 +- db-config.d/010-node_tags | 2 +- 5 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 390d107..4d16d99 100644 --- 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 diff --git a/PLC/Accessors/Accessors_standard.py b/PLC/Accessors/Accessors_standard.py index 774903c..0d773b2 100644 --- a/PLC/Accessors/Accessors_standard.py +++ b/PLC/Accessors/Accessors_standard.py @@ -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", diff --git a/PLC/Methods/AddNode.py b/PLC/Methods/AddNode.py index 90cf14f..c787011 100644 --- a/PLC/Methods/AddNode.py +++ b/PLC/Methods/AddNode.py @@ -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']) diff --git a/PLC/Methods/AddNodeTag.py b/PLC/Methods/AddNodeTag.py index ac6bbd1..81e46c0 100644 --- a/PLC/Methods/AddNodeTag.py +++ b/PLC/Methods/AddNodeTag.py @@ -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'] diff --git a/db-config.d/010-node_tags b/db-config.d/010-node_tags index c25230d..b0062fc 100644 --- a/db-config.d/010-node_tags +++ b/db-config.d/010-node_tags @@ -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: -- 2.43.0