summaryrefslogtreecommitdiffstats
path: root/lib/puppet/interface/v0.0.1/facts.rb
blob: c4bbad8450d8007b7871b1eefee2ef8089250407 (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.define(:facts, '0.0.1') 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