I think I''m running into situations where my variables are being used as floats instead of strings. For example, if my puppet_node_classifier prints this: --- parameters: version: 0.10 and my command is this: command => "/bin/rpm -hiv http://server/package-$version.x86_64.rpm" I think it will attempt to install version 0.1 of my package instead of version 0.10. Is there a way to force the variable to be treated as a string instead of a float in this type of situation? Pete --~--~---------~--~----~------------~-------~--~----~ 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 27/04/09 18:50, Pete Emerson wrote:> I think I''m running into situations where my variables are being used as > floats instead of strings. > > For example, if my puppet_node_classifier prints this: > --- > parameters: > version: 0.10 > > and my command is this: > > command => "/bin/rpm -hiv http://server/package-$version.x86_64.rpm" > > I think it will attempt to install version 0.1 of my package instead of > version 0.10. Is there a way to force the variable to be treated as a > string instead of a float in this type of situation?Did you try double-quoting the number as in: > --- > parameters: > version: "0.10" -- Brice Figureau Days of Wonder http://www.daysofwonder.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Excellent idea, thanks! I was using perl''s YAML module to just dump a hash: print Dump( { parameters=> \%parameters } ); Now I''m just producing the output myself: print "---\nparameters:\n"; foreach my $key (sort keys %parameters) { if (defined $parameters{$key}) { print " $key: \"$parameters{$key}\"\n"; } } I''m not quite sure how to tell YAML module to treat everything as a string (stringify didn''t seem to cut the mustard), but this workaround does the trick. Pete On Mon, Apr 27, 2009 at 11:09 AM, Brice Figureau < brice-puppet@daysofwonder.com> wrote:> > On 27/04/09 18:50, Pete Emerson wrote: > > I think I''m running into situations where my variables are being used as > > floats instead of strings. > > > > For example, if my puppet_node_classifier prints this: > > --- > > parameters: > > version: 0.10 > > > > and my command is this: > > > > command => "/bin/rpm -hiv http://server/package-$version.x86_64.rpm" > > > > I think it will attempt to install version 0.1 of my package instead of > > version 0.10. Is there a way to force the variable to be treated as a > > string instead of a float in this type of situation? > > Did you try double-quoting the number as in: > > --- > > parameters: > > version: "0.10" > > > -- > Brice Figureau > Days of Wonder > http://www.daysofwonder.com > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---