I am attempting to set some variables in my manifest and I amd seeing
a result I don't quite understand. Here is a section of code from my
manifest:

    $boot_time = generate('/usr/bin/env', '/bin/date', '+%H:%m')
    notice("boot_time => $boot_time")

    $boot_hour = regsubst($boot_time,'^([0-9]+)[:]([0-9]+)\n','\1')
    notice("w newline - boot_hour => |$boot_hour|")

    $boot_hour_1 = regsubst($boot_time,'^([0-9]+)[:]([0-9]+)','\1')
    notice("w/o newline - boot_hour_1 => |$boot_hour_1|")

And the lines from the messages file:

  (Scope(Class[main])) boot_time => 09:04
  (Scope(Class[main])) w newline - boot_hour => |09|
  (Scope(Class[main])) w/o newline - boot_hour_1 => |09 |

 What I don't understand is that in the first setting of the variable
the trailing new line is specified in the regsubst pattern but is not
included in the resulting variable. In the second case, the new line
is not specified but is part of the resulting variable. In neither
case is the new line in the capture group. I would think that the
capture would include only the characters specified in the group, i.e.
one or more digits before a colon.

 Can anyone explain this behavior.

Thanks,
Ed

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to