Issue #16903 has been updated by Magnus Forsberg.
Example XML output of Facter -x or --xml would be:
facter rubyversion uptime_days ipaddress_eth0 --xml
<opt rubyversion="1.8.7" uptime_days="1" ipaddress_eth0="192.168.0.1" />
Using Perl SimpleXML we can now do this:
#!/usr/bin/perl -w
use Data::Dumper;
use XML::Simple;
my $xs = new XML::Simple(keeproot => 1,searchpath => ".");
my $ref = $xs->XMLin("inventory.xml");
print Dumper($ref);
and from there feed our inventory system in a Perl script:
perl inventory.pl
Hash dump without 'forcearray => 1':
$VAR1 = {
'opt' => {
'rubyversion' => '1.8.7',
'uptime_days' => '1',
'ipaddress_eth0' => 'eth0',
}
};
----------------------------------------
Feature #16903: Add support to output as XML
https://projects.puppetlabs.com/issues/16903#change-73085
Author: Magnus Forsberg
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Keywords:
Branch: 2.x
Affected Facter version:
Add support to Facter to output facts as XML:
# facter kernel kernelmajversion --xml
<opt kernel="Linux" kernelmajversion="3.1" />
# facter kernel uptime -x
<opt uptime="1 day" kernel="Linux" />
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" 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-bugs?hl=en.