Hello, I am having a hard time getting a variable defined externally to work inside another classes scope. This following snippet of code is giving me a very hard time: case $variable { foo: { $var1 = "blah" } bar: { $var1 = "blee" } default: { fail("variable is used but not defined") } } It fails to default every time, and it should not. The variable is defined like so: exec { "variable": path => "/bin:/usr/bin", command => "export FACTER_variable=$(grep ''pattern'' / path/to/file |cut -d''='' -f2)" } The should have created a new FACT that I assumed would be global to all classes. The variable is created in the "baseclass" that is "included" in this class. (include baseclass) I have also tried having this class "inherit" the baseclass. (class thisclass inherits baseclass {...}) I have tried "qualifying" the variable with the two previous methods (case $baseclass::datacenter {...}) I do not know what else I can try other than simply defining the variable every time I use it. What is the proper include global variables that any class can use, and how do I use them? Thanks, typedeaF --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
The problem is with exec and facts, not scoping, since I can''t even get it to work at all now. New thread opened. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
--On Monday, May 05, 2008 09:41:57 AM -0700 typedeaf <typedeaf@typedeaf.com> wrote:> What is the proper include global variables that any class can use, > and how do I use them?Honestly, I would reexamine your approach and see what it is you are trying to do and see if there is another way to do it. There is probably already a more "puppety" way to do what you are trying to do. If you can illuminate what you are trying to do, maybe we can see if there is a better approach. -- Digant C Kasundra <digant@stanford.edu> Technical Lead, ITS Unix Systems and Applications, Stanford University --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On May 5, 10:41 am, typedeaf <typed...@typedeaf.com> wrote:> command => "export FACTER_variable=$(grep ''pattern'' / > path/to/file |cut -d''='' -f2)" > > What is the proper include global variables that any class can use, > and how do I use them?Rather than have puppet use an exec{} resource, I would add the fact directly with facter. http://reductivelabs.com/trac/puppet/wiki/AddingFacts http://reductivelabs.com/trac/puppet/wiki/PluginsInModules --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---