Hi Denny,

IIRC facter will internally run commands with a C locale to get reliable
command output on different locale settings [1]

    % LC_ALL=de_DE.utf8 /usr/bin/who -b |awk '{print $3}'
    19:34
    % LC_ALL=en_US.utf8 /usr/bin/who -b |awk '{print $3}'
    2017-01-10
    % LC_ALL=C /usr/bin/who -b |awk '{print $3}'
    Jan

[1] https://github.com/puppetlabs/facter/pull/696

On 10.01.2017 17:44, Denny wrote:
> Hi there,
> 
> probably a pretty easy to answer question.
> 
> I want to try out adding custom facts. My first custom fact should be
> "lastrebootdate"
> 
> My code looks like this:
> 
> |
> Facter.add(:lastrebootdate) do
>   setcode do
>     Facter::Util::Resolution.exec("/usr/bin/who -b |awk '{print $3}'")
>   end
> end
> |
> 
> Running the command on the system returns "2017-01-30"
> 
> Deploying my fact on a puppet node and running the puppet agent returns
> "Jan".
> 
> |
> $ puppet facts |grep lastrebootdate
>     "lastrebootdate": "Jan",
> |
> 
> What did I miss?
> 
> Thank you,
> 
> Denny
> 
> -- 
> 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+unsubscr...@googlegroups.com
> <mailto:puppet-users+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/f91eae2b-b980-4dd5-a544-2fc0a2f8e9ef%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/f91eae2b-b980-4dd5-a544-2fc0a2f8e9ef%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/df4e22da-5af0-3c78-b978-2d5c473ae0b7%40posteo.de.
For more options, visit https://groups.google.com/d/optout.

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to