Merge branch 'master' of ssh://git.onelab.eu/git/plcapi
[plcapi.git] / PLC / Accessors / Accessors_standard.py
index 176c4fe..267bae6 100644 (file)
@@ -4,10 +4,8 @@
 from PLC.Nodes import Node
 from PLC.Interfaces import Interface
 from PLC.Slices import Slice
-from PLC.Slices import Slice
 from PLC.Sites import Site
 from PLC.Persons import Person
-#from PLC.Ilinks import Ilink
 
 from PLC.Accessors.Factory import define_accessors, admin_roles, all_roles, tech_roles
 
@@ -26,35 +24,32 @@ current_module = sys.modules[__name__]
 ### slice vref
 define_accessors(current_module, Slice, "Vref", "vref",
                  "slice/config", "vserver reference image name",
+                 set_roles=["admin","pi","user","node"], expose_in_api=True)
+# this contains the actual script text
+# if set, it supersedes 'initscript'
+define_accessors(current_module, Slice, "InitscriptCode","initscript_code",
+                 "slice/usertools", "Slice initialization script code",
                  set_roles=["admin","pi","user"], expose_in_api=True)
+# this may contain a *name* that refers to the GetInitScripts
+# it was initially designed to share scripts among slices
 define_accessors(current_module, Slice, "Initscript","initscript",
-                 "slice/usertools", "Slice initialization script",
+                 "slice/usertools", "Slice initialization script name",
                  set_roles=["admin","pi","user"], expose_in_api=True)
 
-# xxx the accessor factory should enforce the category and descriptions provided here.
-# and BTW the tag should be created right away as far as possible, or at least when a Get is issued
-# also note that the two 'arch' instances use here will end in the same unique TagType object,
-# so you should make sure to use the same category/description for both
-define_accessors(current_module, Slice, "Arch", "arch",
+# BootManager might need to set any of these 3, so 'node' needs to be in set_roles
+# needs 'pi' and 'tech' for managing their node
+# needs 'user' for managing their slices
+# needs 'admin' so the Set method is accessible
+define_accessors(current_module, [Slice,Node], "Arch", "arch",
                  "node/slice/config", "node arch or slivers arch",
-                 set_roles=["pi","user","tech"], expose_in_api=True)
-define_accessors(current_module, Slice, "Pldistro", "pldistro",
-                 "node/slice/config", "PlanetLab distribution to use for node or slivers",
-                 set_roles=["pi","user","tech"], expose_in_api=True)
-define_accessors(current_module, Slice, "Fcdistro", "fcdistro",
+                 set_roles=["admin","pi","user","tech","node"], expose_in_api=True)
+define_accessors(current_module, [Slice,Node], "Pldistro", "pldistro",
+                 "node/slice/config/sfa", "PlanetLab distribution to use for node or slivers",
+                 set_roles=["admin","pi","user","tech","node"], expose_in_api=True)
+define_accessors(current_module, [Slice,Node], "Fcdistro", "fcdistro",
                  "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
-                 set_roles=["pi","user","tech"], expose_in_api=True)
+                 set_roles=["admin","pi","user","tech","node"], expose_in_api=True)
 
-# Ditto for the GetNodeFlavour method
-define_accessors(current_module, Node, "Arch", "arch",
-                 "node/slice/config", "node arch or slivers arch",
-                 set_roles=["pi","user","tech"], expose_in_api=True)
-define_accessors(current_module, Node, "Pldistro", "pldistro",
-                 "node/slice/config", "PlanetLab distribution to use for node or slivers",
-                 set_roles=["pi","user","tech"], expose_in_api=True)
-define_accessors(current_module, Node, "Fcdistro", "fcdistro",
-                 "node/slice/config", "Fedora or CentOS distribution to use for node or slivers",
-                 set_roles=["pi","user","tech"], expose_in_api=True)
 # node deployment (alpha, beta, ...)
 define_accessors(current_module, Node, "Deployment", "deployment",
                  "node/operation", 'typically "alpha", "beta", or "production"',