Bret Wortman
2013-Dec-12 19:25 UTC
[Puppet Users] How best to distribute yaml file for custom fact?
I have a yaml file I''d like to distribute to my systems, and it contains some identifiers which help determine where that system is (this _can_ be determined from the IP address, but it''s so much nicer to use a custom fact -- we''re basically assigning names to our various subnets and storing those in these yaml files where we can use them in manifests and templates). The problem is that we are using them in templates. So when I try to distribute the file, the template fails to parse, and the whole puppet run just aborts. If it were just an error, I could deal with it. But this seems to be a show-stopper. I see that 3.4.0 will have a way to distribute these files as part of pluginsync, but I need this sooner than that (and since I''m in production, I''m hesitant to jump to a .0 release in any case). Any bright ideas? Bret -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/15f7ab89-3e32-4226-a360-fc53d9f3be89%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Felix Frank
2013-Dec-13 16:17 UTC
Re: [Puppet Users] How best to distribute yaml file for custom fact?
Hi, I can at least supply a sensible workaround: In your templates, instead of relying on @factname being available, use has_variable?("@factname") ? @factname : <default value here> Untested, not sure if this works with the @varname syntax in templates. Alternatively, you can do this in site.pp: if ! $factname { $factname = <default> } Depending on circumstance, this won''t address your issue. As yet another alternative, you can keep puppet from parsing the template at all when the fact is not yet present with the same syntax. HTH, Felix On 12/12/2013 08:25 PM, Bret Wortman wrote:> I have a yaml file I''d like to distribute to my systems, and it contains > some identifiers which help determine where that system is (this _can_ > be determined from the IP address, but it''s so much nicer to use a > custom fact -- we''re basically assigning names to our various subnets > and storing those in these yaml files where we can use them in manifests > and templates). > > The problem is that we are using them in templates. So when I try to > distribute the file, the template fails to parse, and the whole puppet > run just aborts. If it were just an error, I could deal with it. But > this seems to be a show-stopper. I see that 3.4.0 will have a way to > distribute these files as part of pluginsync, but I need this sooner > than that (and since I''m in production, I''m hesitant to jump to a .0 > release in any case). > > Any bright ideas? > > > Bret-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/52AB3325.5050200%40alumni.tu-berlin.de. For more options, visit https://groups.google.com/groups/opt_out.
Bret Wortman
2013-Dec-13 17:35 UTC
Re: [Puppet Users] How best to distribute yaml file for custom fact?
That seems to do the trick (I went with the site.pp addition). Thanks for your help! *Bret Wortman* http://about.me/wortmanbret On Fri, Dec 13, 2013 at 11:17 AM, Felix Frank < felix.frank@alumni.tu-berlin.de> wrote:> Hi, > > I can at least supply a sensible workaround: In your templates, instead > of relying on @factname being available, use > > has_variable?("@factname") ? @factname : <default value here> > > Untested, not sure if this works with the @varname syntax in templates. > > Alternatively, you can do this in site.pp: > > if ! $factname { $factname = <default> } > > Depending on circumstance, this won''t address your issue. As yet another > alternative, you can keep puppet from parsing the template at all when > the fact is not yet present with the same syntax. > > HTH, > Felix > > On 12/12/2013 08:25 PM, Bret Wortman wrote: > > I have a yaml file I''d like to distribute to my systems, and it contains > > some identifiers which help determine where that system is (this _can_ > > be determined from the IP address, but it''s so much nicer to use a > > custom fact -- we''re basically assigning names to our various subnets > > and storing those in these yaml files where we can use them in manifests > > and templates). > > > > The problem is that we are using them in templates. So when I try to > > distribute the file, the template fails to parse, and the whole puppet > > run just aborts. If it were just an error, I could deal with it. But > > this seems to be a show-stopper. I see that 3.4.0 will have a way to > > distribute these files as part of pluginsync, but I need this sooner > > than that (and since I''m in production, I''m hesitant to jump to a .0 > > release in any case). > > > > Any bright ideas? > > > > > > Bret > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Puppet Users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/puppet-users/zMDPDGg9Nbw/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > puppet-users+unsubscribe@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/52AB3325.5050200%40alumni.tu-berlin.de > . > For more options, visit https://groups.google.com/groups/opt_out. >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAN9oxgRkrdqAzm2HTxMdsiVGg1em_pgnOizB04C4F4yZdyE5Fw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.