custom facts

38 views
Skip to first unread message

kaustubh chaudhari

unread,
Dec 22, 2014, 10:39:41 AM12/22/14
to puppet...@googlegroups.com
Hi All,

I am trying to run a batch script from custom facts. But unable to get the required output. I know i am doing some thing wrong, but where.
==
Facter.add(:Disk_Size) do
  confine :kernel => "windows"
  setcode do
    Facter::Util::Execution.exec("C:\\Windows\\System32\\cmd.exe C:\\ProgramData\\PuppetLabs\\facter\\facts.d\\diskSize.bat")
  end
end
==
diskSize.bat is a script which returns C: 30GB

I was expecting o/p as.

Disk_Size C: 30GB

Please help!

-Kaustubh

Felix Frank

unread,
Dec 23, 2014, 7:02:23 PM12/23/14
to puppet...@googlegroups.com
On 12/22/2014 04:39 PM, kaustubh chaudhari wrote:
> I was expecting o/p as.
>
> Disk_Size C: 30GB

So what do you get instead?

Have you added debug logging to your script to find out whether Facter
invokes it at all?

kaustubh chaudhari

unread,
Dec 26, 2014, 3:16:12 AM12/26/14
to puppet...@googlegroups.com
Thanks for the Reply Felix.

I found out my mistake. my script was not providing the data in the key=value format. I modified the script and now works fine.

Thanks for asking!!

Cheers and Happy Vacation!

With Warm Regards
Kaustubh.A.Chaudhari
(M)-09373102619


--
You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/Fy9qAwQ4H-A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/549A0280.20207%40Alumni.TU-Berlin.de.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages