Project

General

Profile

Actions

Feature #1843

closed

Accept a simple hash of facts to work with facter directly

Added by Wlodzimierz Kowalski about 12 years ago. Updated about 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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"


Related issues 1 (0 open1 closed)

Related to Foreman - Bug #1938: Foreman shouldn't use the FQDN fact to identify the node when facts are uploadedClosedAmos Benari11/14/2012Actions
Actions #1

Updated by Ohad Levy about 12 years ago

  • Assignee set to Ohad Levy
  • Priority changed from High to Normal
Actions #2

Updated by Ohad Levy about 12 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
Actions #3

Updated by Ohad Levy about 12 years ago

  • Subject changed from Unable to upload facts to Foreman on demand to Accept a simple hash of facts to work with facter directly
Actions

Also available in: Atom PDF