This message was deleted.
# puppet-enterprise
s
This message was deleted.
c
One thing that jumps out is that the
drives.each do
loop is not closed off with an
end
statement. That would cause loading of the file to fail, which would result in no
storage_facts
fact being defined.
j
Thanks, I fixed that but no luck. It did make me think to do the simplest thing and so I created a file with just a single line of text in that last {} block and that appears in the facts list. (so whew, code is getting there).
I had tried using a more complicated call using an example of PowerShell tucked into a Ruby call. Facter.add('windows_storage') do setcode do # storage = Facter:Core:Execution.execute(%q{[powershell "echo $(Get-CimInstance -Classname win32_logicaldisk | # select-object -property DeviceID,VolumeName,@{'Name' = 'Disk Size (GB)'; # Expression= { [int]($_.Size / 1GB)}},@{'Name' = 'Free Disk Space (GB)'; # Expression= { [int]($_.FreeSpace / 1GB)}} | ConvertTo-Json"]}) { disk_info: "storage", } end
That's the one where I just commented the code that wasn't working and put in just the string. (multiple messages cause I didn't know I couldn't hit enter 😉 )
h
facter --debug -p
is how I would debug a fact on a linux system. I assume something similar would work on windows (though it may be
puppet facts --debug
)
j
oooh, thanks. I'll give that a go.