I guess I figured what it was.

The PowerShell output is UTF16 BOM, which it seams that facter cannot handle.

I changed my PowerShell script to generate simple UTF-8 and now it
works just fine.

https://en.wikipedia.org/wiki/Byte_order_mark

http://stackoverflow.com/questions/5596982/using-powershell-to-write-a-file-in-utf-8-without-the-bom


On Mon, Dec 14, 2015 at 4:37 PM, Miguel Di Ciurcio Filho
<[email protected]> wrote:
> Hi there,
>
> I'm trying to create some external facts from PowerShell objects, e.g.:
>
> PS> @{"foo" = "bar"; "foo2" = "bar2"} | ConvertTo-Json | Out-File
> C:\ProgramData\PuppetLabs\facter\facts.d\foo.json
>
> PS> Get-Content C:\ProgramData\PuppetLabs\facter\facts.d\foo.json
> {
>     "foo":  "bar",
>     "foo2":  "bar2"
> }
>
> Here is error Facter shows me:
>
> c:\Program Files\Puppet Labs\Puppet\bin>facter -v
> 3.1.3 (commit 1aa380a82ec35b7f8e7e58fab627e74f93aaeff3)
>
> c:\Program Files\Puppet Labs\Puppet\bin>facter -p foo
> 2015-12-14 10:32:50.582395 ERROR puppetlabs.facter - error while processing 
> "C:/
> ProgramData\PuppetLabs\facter\facts.d\foo.json" for external facts: Invalid 
> valu
> e.
> 2015-12-14 10:32:52.425374 ERROR puppetlabs.facter - error while processing 
> "C:/
> ProgramData\PuppetLabs\facter\facts.d\foo.json" for external facts: Invalid 
> valu
> e.
>
> I've copied the exact same json to a Linux system and it works fine.
>
> It is me or is there a bug?
>
> Regards,
>
> Miguel
>
> --
> http://www.instruct.com.br - 19 2511-6506



-- 
http://www.instruct.com.br - 19 2511-6506

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAK6Ystnkgi_DUs2fZkJvXVvsKucZ4kdAVju0k6_J0H4k0WHiBw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to