Issue #19848 has been updated by Marc Tardif.
The environment of the operating system only knows about strings, it doesn't know about other data types like nils for example. Even though Ruby does support the distinction between string and nil, I would expect something from the realm of strings to remain as such. Furthermore, empty string makes it possible to distinguish variables that are set to nothing from variables that are simply not set. ---------------------------------------- Bug #19848: Exec provider should support environment variables with empty values https://projects.puppetlabs.com/issues/19848#change-87459 * Author: Marc Tardif * Status: Needs More Information * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: * Keywords: * Branch: ---------------------------------------- The exec provider takes an environment parameter that takes either a string or an array of variables. Each variable is expressed as a pair, like "KEY=value" for example. The problem is that the code that parses this string requires a value whereas this is not strictly necessary, like "KEY=" should be perfectly acceptable. The code in Puppet::Provider::Exec.run looks like this: <pre> if setting =~ /^(\w+)=((.|\n)+)$/ env_name = $1 value = $2 </pre> Simply changing the regular expression to use "*" instread of "+" for the value should work just fine: <pre> irb(main):001:0> setting = 'KEY=' => "KEY=" irb(main):002:0> setting =~ /^(\w+)=((.|\n)+)$/ => nil irb(main):003:0> setting =~ /^(\w+)=((.|\n)*)$/ => 0 irb(main):004:0> $1 => "KEY" irb(main):005:0> $2 => "" </pre> So, the value of empty string is exactly what was requested. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
