summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface/facts.rb
blob: 97e22714b3152e3f168d4cac0b86e05a615cbf64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'puppet/interface/indirector'
require 'puppet/node/facts'

Puppet::Interface::Indirector.interface(:facts) do
  set_default_format :yaml

  # Upload our facts to the server
  action(:upload) do
    invoke do |*args|
      Puppet::Node::Facts.indirection.terminus_class = :facter
      facts = Puppet::Node::Facts.indirection.find(Puppet[:certname])
      Puppet::Node::Facts.indirection.terminus_class = :rest
      Puppet::Node::Facts.indirection.save(facts)
      Puppet.notice "Uploaded facts for '#{Puppet[:certname]}'"
      nil
    end
  end
end