[rudder-dev] Best Practises for writing techniques

Nicolas Charles nicolas.charles at normation.com
Mon Mar 4 09:49:16 CET 2013


On 01/03/2013 12:10, Michael Gliwinski wrote:
> Thanks for your answer, before I start thinking about the rest, just a
> question about variables.  Just whenever you have time, just trying to
> understand what's going on :)
>
> On Thursday 28 Feb 2013 18:31:24 Nicolas Charles wrote:
>>> 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)
> Would that be something different between how Rudder drives CFEngine and plain
> CFEngine?
>
> I wrote a couple of tests yesterday and based my assumptions on that.  This
> appears to work, i.e. when running `cf-agent -f ./cf-test-var-deps.cf -KI` I
> get:
>
> R: [master/master_config] mnt.technique_name = 'mnt'
> R: [master/master_config] mnt_config.point[1] = '/tmp/mntbar'
> R: [master/master_config] mnt_config.point[0] = '/tmp/mntfoo'
> R: [master/master] master_config.foo = 'master'
> R: [mnt/mnt_config] master_config.foo_file = '/tmp/foo'
> R: [mnt/mnt_config] master_config.bar_file = '/tmp/bar'

Ha !
This is really interesting ! I didn't know that it worked reliably 
(even, I assumed vars had to be defined to be used). I wonder how 
CFEngine can resolve these values, but it outlines a new set of 
possibility for Techniques

Thanks for sharing your knowledge !
Nicolas



More information about the rudder-dev mailing list