Actions
Feature #1843
closedAccept a simple hash of facts to work with facter directly
Description
In correspondence to the topic under: https://groups.google.com/forum/?fromgroups=#!topic/foreman-users/Y91OfgTkg3c
The user is unable to upload facts to foreman on demand. Issuing the following code:
url="https://192.168.199.40:443" require 'fileutils' require 'net/http' require 'net/https' require 'uri' require 'facter' require 'yaml' #in order to get facts in a proper format facts = `puppet facts --render-as yaml find host.domain` begin uri = URI.parse(url) http = Net::HTTP.new(uri.host, uri.port) if uri.scheme == 'https' then http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE end req = Net::HTTP::Post.new("/fact_values/create") req.set_form_data({'facts' => facts}) response = http.request(req) rescue Exception => e raise "Could not send facts to Foreman: #{e}" end
doesn't work.
Right now, as Ohad says: "we do check within foreman that the object we get is a serialized puppet facts, and I'm guessing we can relax that requirements to a simple facts hash, please open a new feature request and I'll have to resolve it"
Actions