cleanup accessors
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 1 Dec 2010 16:01:54 +0000 (17:01 +0100)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 1 Dec 2010 16:01:54 +0000 (17:01 +0100)
PLC/Accessors/Accessors_example_ple.py
PLC/Accessors/Accessors_sliverauth.py
PLC/Accessors/Accessors_wireless.py
PLC/Accessors/Factory.py

index 77774d7..6559abf 100644 (file)
@@ -1,6 +1,4 @@
 # Thierry Parmentelat - INRIA
-# $Id: Accessors_site.py 14587 2009-07-19 13:18:50Z thierry $
-# $URL: http://svn.planet-lab.org/svn/PLCAPI/tags/PLCAPI-4.3-29/PLC/Accessors/Accessors_site.py $
 #
 
 methods=[]
@@ -38,14 +36,14 @@ define_accessors(current_module, Node, "Reliability", "reliability",
                  "node/monitor/ui/header=R/type=int/rank=ad",
                  # description : used to add a footnote to the table if header is set in category
                  "average reliability (% uptime) over the last week",
-                  get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
+                  set_roles=tech_roles, expose_in_api=True)
 
 define_accessors(current_module, Node, "Load", "load",
                  "node/monitor/ui/header=l/type=sortAlphaNumericBottom",
                  "average load (% CPU utilization) over the last week",
-                  get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
+                  set_roles=tech_roles, expose_in_api=True)
 
 define_accessors(current_module, Node, "ASNumber", "asnumber",
                  "node/location/ui/header=AS/type=sortAlphaNumericBottom/rank=z",
                  "Autonomous System id",
-                 get_roles=all_roles, set_roles=tech_roles, expose_in_api=True)
+                 set_roles=tech_roles, expose_in_api=True)
index 088560e..e8ca0c2 100644 (file)
@@ -15,9 +15,9 @@ current_module = sys.modules[__name__]
 
 define_accessors(current_module, Slice, "OmfControl","omf_control",
                  "slice/usertools","Pre-install and configure OMF Resource Controller in slice if set",
-                 get_roles=all_roles, set_roles=all_roles, expose_in_api=True)
+                 set_roles=all_roles, expose_in_api=True)
 
 
 define_accessors(current_module, Slice, "SliverHMAC","enable_hmac",
                  "slice/usertools","Create HMAC keys for node in slice (slivers)",
-                 get_roles=all_roles, set_roles=all_roles, expose_in_api=True)
+                 set_roles=all_roles, expose_in_api=True)
index 12b5bd9..67af16e 100644 (file)
@@ -14,46 +14,46 @@ current_module = sys.modules[__name__]
 #### Wireless
 define_accessors(current_module, Interface, "Mode", "mode",
                  "interface/wifi", "Wifi operation mode - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Essid", "essid",
                  "interface/wifi", "Wireless essid - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Nw", "nw",
                  "interface/wifi", "Wireless nw - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Freq", "freq",
                  "interface/wifi", "Wireless freq - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Channel", "channel",
                  "interface/wifi", "Wireless channel - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Sens", "sens",
                  "interface/wifi", "Wireless sens - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Rate", "rate",
                  "interface/wifi", "Wireless rate - see iwconfig",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Key", "key",
                  "interface/wifi", "Wireless key - see iwconfig key",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Key1", "key1",
                  "interface/wifi", "Wireless key1 - see iwconfig key[1]",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Key2", "key2",
                  "interface/wifi", "Wireless key2 - see iwconfig key[2]",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Key3", "key3",
                  "interface/wifi", "Wireless key3 - see iwconfig key[3]",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Key4", "key4",
                  "interface/wifi", "Wireless key4 - see iwconfig key[4]",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "SecurityMode", "securitymode",
                  "interface/wifi", "Wireless securitymode - see iwconfig enc",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Iwconfig", "iwconfig",
                  "interface/wifi", "Wireless iwconfig - see ifup-wireless",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
 define_accessors(current_module, Interface, "Iwpriv", "iwpriv",
                  "interface/wifi", "Wireless iwpriv - see ifup-wireless",
-                 get_roles=all_roles, set_roles=tech_roles)
+                 set_roles=tech_roles)
index e4ef578..fec0d63 100644 (file)
@@ -57,9 +57,8 @@ tech_roles = [ 'admin', 'pi', 'tech' ]
 # The expose_in_api flag tells whether this tag may be handled
 #   through the Add/Get/Update methods as a native field
 #
-# note: roles get attached to the tagtype instance,
-# while get_roles and set_roles get attached to the created methods
-# this might need a cleanup
+# note: set_roles get attached as 'roles' to the tagtype instance,
+# also get_roles and set_roles get attached to the created methods
 #
 # in addition a convenience method like e.g. LocateNodeArch is defined
 # in the Accessor class; its purpose is to retrieve the tag, or to create it if needed
@@ -67,7 +66,7 @@ tech_roles = [ 'admin', 'pi', 'tech' ]
 # Legacy NOTE:
 # prior to plcapi-5.0-19, this used to accept an additional argument
 # named min_role_id; this was redundant and confusing, it has been
-# removed, we now use set_roles to restrict access on the corresponding tag
+# removed, we now use set_roles to restrict write access on the corresponding tag
 
 # the convention here is that methodsuffix should be mixed case, e.g. MyStuff
 # while tagname is expected to be lowercase