[Puppet Users] Re: Variables in definitions

David Schmitt
Fri, 12 Jun 2009 06:45:58 -0000

DrKJam schrieb:
> Hi,
>
> A quick "Hello" to every as this is my first post on the Puppet
Users group.
>
> I had some training with Teyo in London recently and am busy
> evaluating Puppet to replace a config engine developed for internal
> use at my company.
>
> Question: Is it possible to refer to variables declared inside
> realised definitions?
>
> Here''s a basic example of how to refer to variables defined inside
the
> scope of a class that is not your own :-
>
> test.pp
> ----------
> class foo {
>     $bar = ''baz''
> }
> include foo
> notice("$foo::bar")
>
> output :-
> ----------
> notice: Scope(Class[main]): baz
>
> Is there any equivalent syntax for definitions along the lines of :-
>
> $foo[''somename'']::bar
>
> Is it possible to do something similar with definitions or is this
> just abuse of Puppet principles ;-)

Currently this is not possible.

> Basically what I''m trying to achieve is the set up of a bunch of
> scopes with variables in them. These are then combined in various ways
> to configure multiple instances of an application on a individual
> system (of which there may be many).
>
> It''s proving to be tougher than I thought ;-)
>
> Any thoughts or suggestions on the direction I could take from here?

That''s a tough question to answer without actually seeing your specific
requirements.

The common way would be to create a define representing application
instances and using this define to setup instances:

| define application($path1, $path2, $param1, $param2) { ... }


Regards, DavidS
--
dasz.at OG              Tel: +43 (0)664 2602670     Web: http://dasz.at
Klosterneuburg                                         UID: ATU64260999

        FB-Nr.: FN 309285 g          FB-Gericht: LG Korneuburg

--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---