On Oct 12, 4:23 pm, Mohamed Lrhazi <lrh...@gmail.com> wrote:
> I have a custom fact called:  gu_app_oracle_rac
>
> Which gets set, indirectly, by puppet itself... and so in the very
> first run it does not exist... I will be changing the whole business
> of how I set these facts, but I need a quick workaround to the
> following issue...
>
> I have some templates using that variable and so the first run fails
> because the var is undefined, and so I added this to site.pp:
>
> if !defined(gu_app_oracle_rac) {
>     $gu_app_oracle_rac = false
>
> }
>
> Now, this allows the first run, maybe a few, to work... then when the
> fact comes to life, I get:
>
> Cannot reassign variable gu_app_oracle_rac in site.pp
>
> Why doesn't the *if* statement do what I expect it to do?


Amplifying what Nan said, the 'defined' function is documented to be
for use with classes, resource types, and resource instances.  In your
case, therefore, it is looking for a class or definition named
"gu_app_oracle_rac", and returning false when it doesn't find one.
Even if it worked on variables, however, 'defined' is parse-order
dependent and Puppet parse order is unpredictable, so using 'defined'
is never a good idea.  Ever.

As to the underlying problem, I'm confused about your description.  If
gu_app_oracle_rac is a custom fact, then aren't you delivering it to
clients via pluginsync?  If so then it should be available on every
run, including the first.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to