Project

General

Profile

Bug #2816 » report.json

Greg Sutcliffe, 10/17/2013 10:17 AM

 
{
"report": {
"id": 128560,
"reported_at": "2013-10-17T10:03:35Z",
"status": {
"applied": 0,
"restarted": 0,
"failed": 0,
"failed_restarts": 0,
"skipped": 0,
"pending": 5
},
"metrics": {
"resources": {
"changed": 0,
"failed": 0,
"failed_to_restart": 0,
"out_of_sync": 4,
"restarted": 0,
"scheduled": 0,
"skipped": 0,
"total": 219
},
"time": {
"augeas": 0.148012363,
"config_retrieval": 23.742822807,
"cron": 0.001685499,
"exec": 0.002221538,
"file": 0.9056699830000001,
"file_line": 0.00138427,
"filebucket": 0.000942659,
"package": 0.01713038,
"schedule": 0.0033408959999999994,
"service": 0.333043756,
"total": 25.167035744,
"user": 0.010781592999999999
},
"changes": {
"total": 0
},
"events": {
"failure": 0,
"noop": 5,
"success": 0,
"total": 5
}
},
"summary": "Success",
"logs": [
{
"log": {
"level": "notice",
"sources": {
"source": "Stage[main]"
},
"messages": {
"message": "Would have triggered 'refresh' from 3 events"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "Class[Foreman::Config::Enc]"
},
"messages": {
"message": "Would have triggered 'refresh' from 2 events"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "Class[Foreman_proxy::Puppetca]"
},
"messages": {
"message": "Would have triggered 'refresh' from 1 events"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Foreman::Config::Enc/File[/etc/puppet/node.rb]/group"
},
"messages": {
"message": "current_value root, should be puppet (noop)"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Foreman::Config::Enc/File[/etc/puppet/node.rb]/content"
},
"messages": {
"message": "current_value {md5}122a867cd26b5d5df0a6d55c5e9dd1f6, should be {md5}22883cc715af17fbd66b90b28fcc26bc (noop)"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Foreman::Config::Enc/File[/etc/puppet/node.rb]/content"
},
"messages": {
"message": "\n--- /etc/puppet/node.rb\t2013-10-17 01:47:36.465499513 +0100\n+++ /tmp/puppet-file20131017-26365-ee0zhx\t2013-10-17 11:04:20.955492975 +0100\n@@ -1,11 +1,16 @@\n #!/usr/bin/env ruby\n+### File managed with puppet ###\n+## Served by: 'topaz.elysium.emeraldreverie.org'\n+## Module: 'foreman'\n+## Template source: 'MODULES/foreman/templates/external_node.rb.erb'\n+\n \n-# If copying this template by hand, replace the settings below including the angle brackets\n SETTINGS = {\n :url => \"https://topaz.elysium.emeraldreverie.org\",\n :puppetdir => \"/var/lib/puppet\",\n :facts => true,\n- :timeout => 10,\n+ :storeconfigs => false,\n+ :timeout => 3,\n # if CA is specified, remote Foreman host will be verified\n :ssl_ca => \"/var/lib/puppet/ssl/certs/ca.pem\",\n # ssl_cert and key are required if require_ssl_puppetmasters is enabled in Foreman\n@@ -39,67 +44,39 @@\n SETTINGS[:timeout] || 3\n end\n \n-require 'etc'\n require 'net/http'\n require 'net/https'\n require 'fileutils'\n require 'timeout'\n-require 'yaml'\n-begin\n- require 'json'\n-rescue LoadError\n- # Debian packaging guidelines state to avoid needing rubygems, so\n- # we only try to load it if the first require fails (for RPMs)\n- begin\n- require 'rubygems' rescue nil\n- require 'json'\n- rescue LoadError => e\n- puts \"You need the `json` gem to use the Foreman ENC script\"\n- # code 1 is already used below\n- exit 2\n- end\n-end\n \n def upload_all_facts\n Dir[\"#{puppetdir}/yaml/facts/*.yaml\"].each do |f|\n certname = File.basename(f, \".yaml\")\n- # Skip empty host fact yaml files\n- if File.size(f) != 0\n- upload_facts(certname, f)\n- end\n+ upload_facts(certname, f)\n end\n end\n \n-def build_body(certname,filename)\n- # Strip the Puppet:: ruby objects and keep the plain hash\n- facts = File.read(filename)\n- puppet_facts = YAML::load(facts.gsub(/\\!ruby\\/object.*$/,''))\n- hostname = puppet_facts['values']['fqdn'] || certname\n- {'facts' => puppet_facts['values'], 'name' => hostname, 'certname' => certname}\n-end\n-\n def upload_facts(certname, filename)\n # Temp file keeping the last run time\n stat = stat_file(certname)\n last_run = File.exists?(stat) ? File.stat(stat).mtime.utc : Time.now - 365*24*60*60\n last_fact = File.stat(filename).mtime.utc\n if last_fact > last_run\n+ fact = File.read(filename)\n begin\n- uri = URI.parse(\"#{url}/api/hosts/facts\")\n- req = Net::HTTP::Post.new(uri.request_uri)\n- req.add_field('Accept', 'application/json,version=2' )\n- req.content_type = 'application/json'\n- req.body = build_body(certname, filename).to_json\n- res = Net::HTTP.new(uri.host, uri.port)\n- res.use_ssl = uri.scheme == 'https'\n+ uri = URI.parse(\"#{url}/fact_values/create?format=yml\")\n+ req = Net::HTTP::Post.new(uri.path)\n+ req.set_form_data('facts' => fact)\n+ res = Net::HTTP.new(uri.host, uri.port)\n+ res.use_ssl = uri.scheme == 'https'\n if res.use_ssl?\n- if SETTINGS[:ssl_ca] && !SETTINGS[:ssl_ca].empty?\n+ if SETTINGS[:ssl_ca]\n res.ca_file = SETTINGS[:ssl_ca]\n res.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n res.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n- if SETTINGS[:ssl_cert] && !SETTINGS[:ssl_cert].empty? && SETTINGS[:ssl_key] && !SETTINGS[:ssl_key].empty?\n+ if SETTINGS[:ssl_cert] and SETTINGS[:ssl_key]\n res.cert = OpenSSL::X509::Certificate.new(File.read(SETTINGS[:ssl_cert]))\n res.key = OpenSSL::PKey::RSA.new(File.read(SETTINGS[:ssl_key]), nil)\n end\n@@ -124,17 +101,17 @@\n def enc(certname)\n foreman_url = \"#{url}/node/#{certname}?format=yml\"\n uri = URI.parse(foreman_url)\n- req = Net::HTTP::Get.new(uri.request_uri)\n+ req = Net::HTTP::Get.new(foreman_url)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == 'https'\n if http.use_ssl?\n- if SETTINGS[:ssl_ca] && !SETTINGS[:ssl_ca].empty?\n+ if SETTINGS[:ssl_ca]\n http.ca_file = SETTINGS[:ssl_ca]\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n- if SETTINGS[:ssl_cert] && !SETTINGS[:ssl_cert].empty? && SETTINGS[:ssl_key] && !SETTINGS[:ssl_key].empty?\n+ if SETTINGS[:ssl_cert] and SETTINGS[:ssl_key]\n http.cert = OpenSSL::X509::Certificate.new(File.read(SETTINGS[:ssl_cert]))\n http.key = OpenSSL::PKey::RSA.new(File.read(SETTINGS[:ssl_key]), nil)\n end\n@@ -146,52 +123,34 @@\n end\n \n # Actual code starts here\n-\n-if __FILE__ == $0 then\n- # Setuid to puppet if we can\n- begin\n- Process::GID.change_privilege(Etc.getgrnam('puppet').gid) unless Etc.getpwuid.name == 'puppet'\n- Process::UID.change_privilege(Etc.getpwnam('puppet').uid) unless Etc.getpwuid.name == 'puppet'\n- rescue\n- $stderr.puts \"cannot switch to user 'puppet', continuing as '#{Etc.getpwuid.name}'\"\n- end\n-\n- begin\n- no_env = ARGV.delete(\"--no-environment\")\n- if ARGV.delete(\"--push-facts\")\n- # push all facts files to Foreman and don't act as an ENC\n- upload_all_facts\n- else\n- certname = ARGV[0] || raise(\"Must provide certname as an argument\")\n- # send facts to Foreman - enable 'facts' setting to activate\n- # if you use this option below, make sure that you don't send facts to foreman via the rake task or push facts alternatives.\n- #\n- if SETTINGS[:facts]\n- upload_facts certname, \"#{puppetdir}/yaml/facts/#{certname}.yaml\"\n- end\n- #\n- # query External node\n- begin\n- result = \"\"\n- timeout(tsecs) do\n- result = enc(certname)\n- cache(certname, result)\n- end\n- rescue TimeoutError, SocketError, Errno::EHOSTUNREACH, Errno::ECONNREFUSED\n- # Read from cache, we got some sort of an error.\n- result = read_cache(certname)\n- ensure\n- require 'yaml'\n- yaml = YAML.load(result)\n- if no_env\n- yaml.delete('environment')\n- end\n- # Always reset the result to back to clean yaml on our end\n- puts yaml.to_yaml\n+begin\n+ if ARGV.delete(\"--push-facts\")\n+ # push all facts files to Foreman and don't act as an ENC\n+ upload_all_facts\n+ else\n+ certname = ARGV[0] || raise(\"Must provide certname as an argument\")\n+ # send facts to Foreman - enable 'facts' setting to activate\n+ # if you use this option below, make sure that you don't send facts to foreman via the rake task or push facts alternatives.\n+ #\n+ if SETTINGS[:facts] && !SETTINGS[:storeconfigs]\n+ upload_facts certname, \"#{puppetdir}/yaml/facts/#{certname}.yaml\"\n+ end\n+ #\n+ # query External node\n+ begin\n+ result = \"\"\n+ timeout(tsecs) do\n+ result = enc(certname)\n+ cache(certname, result)\n end\n+ rescue TimeoutError, SocketError, Errno::EHOSTUNREACH\n+ # Read from cache, we got some sort of an error.\n+ result = read_cache(certname)\n+ ensure\n+ puts result\n end\n- rescue => e\n- warn e\n- exit 1\n end\n+rescue => e\n+ warn e\n+ exit 1\n end\n"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "Class[Puppet::Config]"
},
"messages": {
"message": "Would have triggered 'refresh' from 2 events"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Puppet::Config/File[/etc/puppet/auth.conf]/content"
},
"messages": {
"message": "current_value {md5}1891233908ecf2dd0fff8a73a3a97097, should be {md5}7cc5b0639433cb46e83beebaddedd8ad (noop)"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Puppet::Config/File[/etc/puppet/auth.conf]/content"
},
"messages": {
"message": "\n--- /etc/puppet/auth.conf\t2013-10-17 02:20:16.000000000 +0100\n+++ /tmp/puppet-file20131017-26365-3jmtyd\t2013-10-17 11:04:20.615490921 +0100\n@@ -1,19 +1,14 @@\n-# This is the default auth.conf file, which implements the default rules\n-# used by the puppet master. (That is, the rules below will still apply\n-# even if this file is deleted.)\n-#\n-# The ACLs are evaluated in top-down order. More specific stanzas should\n-# be towards the top of the file and more general ones at the bottom;\n-# otherwise, the general rules may \"steal\" requests that should be\n-# governed by the specific rules.\n+# This file implements the defaults used by the puppet master.\n #\n-# See http://docs.puppetlabs.com/guides/rest_auth_conf.html for a more complete\n-# description of auth.conf's behavior.\n+# The ACLs are evaluated in top-down order. More general\n+# stanzas should be towards the bottom of the file and more\n+# specific ones at the top, otherwise the general rules\n+# take precedence and later rules will not be evaluated.\n #\n # Supported syntax:\n-# Each stanza in auth.conf starts with a path to match, followed\n+# Each stanza in auth.conf starts with a path to mach, followed\n # by optional modifiers, and finally, a series of allow or deny\n-# directives.\n+# directives. \n #\n # Example Stanza\n # ---------------------------------\n@@ -22,33 +17,25 @@\n # [environment envlist]\n # [method methodlist]\n # [auth[enthicated] {yes|no|on|off|any}]\n-# allow [host|backreference|*|regex]\n-# deny [host|backreference|*|regex]\n+# allow [host|backreference|*]\n+# deny [host|backreference|*]\n # allow_ip [ip|cidr|ip_wildcard|*]\n # deny_ip [ip|cidr|ip_wildcard|*]\n #\n-# The path match can either be a simple prefix match or a regular\n+# The path match can either be a simple prefix match or a regular \n # expression. `path /file` would match both `/file_metadata` and\n # `/file_content`. Regex matches allow the use of backreferences\n # in the allow/deny directives.\n-#\n+# \n # The regex syntax is the same as for Ruby regex, and captures backreferences\n # for use in the `allow` and `deny` lines of that stanza\n #\n # Examples:\n+# path ~ ^/path/to/resource # equivalent to `path /path/to/resource`\n+# allow *\n #\n-# path ~ ^/path/to/resource # Equivalent to `path /path/to/resource`.\n-# allow * # Allow all authenticated nodes (since auth\n-# # defaults to `yes`).\n-#\n-# path ~ ^/catalog/([^/]+)$ # Permit nodes to access their own catalog (by\n-# allow $1 # certname), but not any other node's catalog.\n-#\n-# path ~ ^/file_(metadata|content)/extra_files/ # Only allow certain nodes to\n-# auth yes # access the \"extra_files\"\n-# allow /^(.+)\\.example\\.com$/ # mount point; note this must\n-# allow_ip 192.168.100.0/24 # go ABOVE the \"/file\" rule,\n-# # since it is more specific.\n+# path ~ ^/catalog/([^/]+)$ # permit access only for the\n+# allow $1 # node whose cert matches the path\n #\n # environment:: restrict an ACL to a comma-separated list of environments\n # method:: restrict an ACL to a comma-separated list of HTTP methods\n@@ -57,7 +44,7 @@\n # (ie exactly as if auth yes was present).\n #\n \n-### Authenticated ACLs - these rules apply only when the client\n+### Authenticated paths - these apply only when the client\n ### has a valid certificate and is thus authenticated\n \n # allow nodes to retrieve their own catalog\n@@ -75,42 +62,38 @@\n method find\n allow *\n \n-# allow all nodes to store their own reports\n-path ~ ^/report/([^/]+)$\n+# allow all nodes to store their reports\n+path /report\n method save\n-allow $1\n+allow *\n \n-# Allow all nodes to access all file services; this is necessary for\n-# pluginsync, file serving from modules, and file serving from custom\n-# mount points (see fileserver.conf). Note that the `/file` prefix matches\n-# requests to both the file_metadata and file_content paths. See \"Examples\"\n-# above if you need more granular access control for custom mount points.\n+# unconditionally allow access to all file services\n+# which means in practice that fileserver.conf will\n+# still be used\n path /file\n allow *\n \n-### Unauthenticated ACLs, for clients without valid certificates; authenticated\n-### clients can also access these paths, though they rarely need to.\n+### Unauthenticated ACL, for clients for which the current master doesn't\n+### have a valid certificate; we allow authenticated users, too, because\n+### there isn't a great harm in letting that request through.\n \n-# allow access to the CA certificate; unauthenticated nodes need this\n-# in order to validate the puppet master's certificate\n+# allow access to the master CA\n path /certificate/ca\n auth any\n method find\n allow *\n \n-# allow nodes to retrieve the certificate they requested earlier\n path /certificate/\n auth any\n method find\n allow *\n \n-# allow nodes to request a new certificate\n path /certificate_request\n auth any\n method find, save\n allow *\n \n-# deny everything else; this ACL is not strictly necessary, but\n-# illustrates the default policy.\n+# this one is not stricly necessary, but it has the merit\n+# of showing the default policy, which is deny everything else\n path /\n auth any\n"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Foreman_proxy::Puppetca/File[/etc/puppet/autosign.conf]/owner"
},
"messages": {
"message": "current_value puppet, should be foreman-proxy (noop)"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Puppet::Config/File[/etc/puppet/puppet.conf]/content"
},
"messages": {
"message": "current_value {md5}c7f8e3f182e63cd40f4b6b1c349fdb90, should be {md5}c6b3a2d15bc24b2a09686f3aff5754f9 (noop)"
}
}
},
{
"log": {
"level": "notice",
"sources": {
"source": "/Stage[main]/Puppet::Config/File[/etc/puppet/puppet.conf]/content"
},
"messages": {
"message": "\n--- /etc/puppet/puppet.conf\t2013-10-17 10:45:49.102108447 +0100\n+++ /tmp/puppet-file20131017-26365-1brey6f\t2013-10-17 11:04:20.405489652 +0100\n@@ -4,7 +4,6 @@\n ## Template source: 'MODULES/puppet/templates/puppet.conf.erb'\n \n [main]\n-noop=true\n # The Puppet var directory\n # The default value is '/var/lib/puppet'\n vardir = /var/lib/puppet\n"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Applying configuration version '1382004120'"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Caching catalog for topaz.elysium.emeraldreverie.org"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Loading facts in /var/lib/puppet/lib/facter/pe_version.rb"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Loading facts in /var/lib/puppet/lib/facter/root_home.rb"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb"
}
}
},
{
"log": {
"level": "info",
"sources": {
"source": "Puppet"
},
"messages": {
"message": "Retrieving plugin"
}
}
}
]
}
}
(3-3/3)