[rudder-dev] Best Practises for writing techniques

Nicolas Charles nicolas.charles at normation.com
Thu Feb 28 18:31:24 CET 2013


On 28/02/2013 12:31, Michael Gliwinski wrote:
> Hi all,
Hi Michael,

>
> I read the new Best Practices doc, looks fantastic, really like the file
> splitting convention :)
>
> Also had a look at the sshConfiguration in master and can't wait to migrate to
> 2.5 to use the new common reporting helpers :D
\o/
>
> Also a couple of questions, just to better understand intentions, etc.
>
> 1. prefixing variables with "rudder_" or "rudder_<technique_name>_"; given
> that to reference variables from other bundles you have to do
> "rudder_<technique_name>_<action>.<variable>" anyway, is that necessary?
That's a good point, maybe we've been overzealous on this convention. I 
think we could use only rudder_ to prevent overly long variable names

>
> 2. files convention section refers to bundle "run", is that just the main
> entry point bundle of a technique?
The bundle _run (or any meaningful name if there are multiple bundles to 
execute) are pure cfengine code, and hence are not the entry point for 
the bundle.
The config.st file is the entry point, where all variables are defined, 
and it should call every other bundles

>
> 3. config.st:
>
> 3a. is the idea to aggregate various variables used within different bundles
> in a technique in one place?  (sounds neat)
Variables defined by Rudder must only go in this file, so yes, the idea 
is to have all variables there

>
> 3b. what is the best method to ensure it's included (reference from<BUNDLES>
> in metadata.xml, methods: in main.st, etc.)
So far, the only way is to add the bundle name in the BUNDLES entry of 
the metadata, as you stated
All the files with CFEngine code should be listed in the <TMLS> tags
>
> 3c. initial tests show it should be OK, but do you think there could be
> problems using those variables from other (e.g. associated) techniques?
Unfortunately, yes, there could.
We have no way do define the order in which the bundles will be 
executed, so there is no guarantee that the variable will already be 
defined when calling it from another technique (unless you define some 
variables in the bundle common)
>
> Thanks for your fantastic work!
Thank you for your feedback !
I hope my answer helped you understand the intention.

Nicolas


More information about the rudder-dev mailing list