quixoten-puppetdb-terminus 2.1.0 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +5 -5
- data/lib/puppet/indirector/catalog/puppetdb.rb +16 -2
- data/lib/puppet/indirector/facts/puppetdb.rb +14 -3
- data/lib/puppetdb/terminus/version.rb +2 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b8ac64ec0646cb863eb8ff02d7d836fa72ae388
|
4
|
+
data.tar.gz: 391e0dca5929e6f08884327cd6da5fee22dc9e33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78020e2b1c69634080fbae981f83f0ded959d66c63415ef73808d6325c45ae0ddca7d40af0e1f0e1b3bf9bb9dd3e9e915d7817466c7947bb988d934ad8621895
|
7
|
+
data.tar.gz: b72efd6f4dbe6ee0a1b289062cdc6f6ebc0eb965762d48666263897fb8c3884f2f7865daef4f1121e1fe34f21339aa5f80446021defc84d75c97ec8295826b8c
|
data/Rakefile
CHANGED
@@ -2,15 +2,15 @@ require "bundler/gem_tasks"
|
|
2
2
|
require "fileutils"
|
3
3
|
require "puppetdb-terminus"
|
4
4
|
|
5
|
-
desc "
|
6
|
-
task :
|
7
|
-
version = ::PuppetDB::Terminus::
|
5
|
+
desc "Synchronize lib/puppet with PuppetDB v#{PuppetDB::Terminus::UPSTREAM_VERSION} source"
|
6
|
+
task :sync_with_upstream do
|
7
|
+
version = ::PuppetDB::Terminus::UPSTREAM_VERSION
|
8
8
|
archive = "#{version}.tar.gz"
|
9
9
|
url = "https://github.com/puppetlabs/puppetdb/archive/#{archive}"
|
10
10
|
|
11
11
|
`curl -sLO #{url}`
|
12
12
|
FileUtils::rm_rf File.expand_path('../lib/puppet', __FILE__)
|
13
|
-
`tar
|
13
|
+
`tar -zxf #{archive} puppetdb-#{version}/puppet/lib/ --strip-components=2`
|
14
14
|
end
|
15
15
|
|
16
|
-
task :build => :
|
16
|
+
task :build => :sync_with_upstream
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'puppet/resource/catalog'
|
2
2
|
require 'puppet/indirector/rest'
|
3
3
|
require 'puppet/util/puppetdb'
|
4
|
+
require 'time'
|
4
5
|
|
5
6
|
class Puppet::Resource::Catalog::Puppetdb < Puppet::Indirector::REST
|
6
7
|
include Puppet::Util::Puppetdb
|
@@ -14,8 +15,7 @@ class Puppet::Resource::Catalog::Puppetdb < Puppet::Indirector::REST
|
|
14
15
|
def save(request)
|
15
16
|
profile "catalog#save" do
|
16
17
|
catalog = munge_catalog(request.instance, extract_extra_request_data(request))
|
17
|
-
|
18
|
-
submit_command(request.key, catalog, CommandReplaceCatalog, 4)
|
18
|
+
submit_command(request.key, catalog, CommandReplaceCatalog, 5)
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -28,6 +28,7 @@ class Puppet::Resource::Catalog::Puppetdb < Puppet::Indirector::REST
|
|
28
28
|
{
|
29
29
|
:transaction_uuid => request.options[:transaction_uuid],
|
30
30
|
:environment => request.environment,
|
31
|
+
:producer_timestamp => request.options[:producer_timestamp] || Time.now.iso8601,
|
31
32
|
}
|
32
33
|
end
|
33
34
|
|
@@ -49,6 +50,7 @@ class Puppet::Resource::Catalog::Puppetdb < Puppet::Indirector::REST
|
|
49
50
|
filter_keys(data)
|
50
51
|
add_transaction_uuid(data, extra_request_data[:transaction_uuid])
|
51
52
|
add_environment(data, extra_request_data[:environment])
|
53
|
+
add_producer_timestamp(data, extra_request_data[:producer_timestamp])
|
52
54
|
|
53
55
|
data
|
54
56
|
end
|
@@ -77,6 +79,18 @@ class Puppet::Resource::Catalog::Puppetdb < Puppet::Indirector::REST
|
|
77
79
|
hash
|
78
80
|
end
|
79
81
|
|
82
|
+
# Include producer_timestamp in hash, returning the complete hash.
|
83
|
+
#
|
84
|
+
# @param hash [Hash] original data hash
|
85
|
+
# @param producer_timestamp [String or nil] producer_tiemstamp
|
86
|
+
# @return [Hash] returns original hash augmented with producer_timestamp
|
87
|
+
# @api private
|
88
|
+
def add_producer_timestamp(hash, producer_timestamp)
|
89
|
+
hash['producer-timestamp'] = producer_timestamp
|
90
|
+
|
91
|
+
hash
|
92
|
+
end
|
93
|
+
|
80
94
|
# Include transaction_uuid in hash, returning the complete hash.
|
81
95
|
#
|
82
96
|
# @param hash [Hash] original data hash
|
@@ -3,6 +3,7 @@ require 'puppet/node/facts'
|
|
3
3
|
require 'puppet/indirector/rest'
|
4
4
|
require 'puppet/util/puppetdb'
|
5
5
|
require 'json'
|
6
|
+
require 'time'
|
6
7
|
|
7
8
|
class Puppet::Node::Facts::Puppetdb < Puppet::Indirector::REST
|
8
9
|
include Puppet::Util::Puppetdb
|
@@ -13,23 +14,33 @@ class Puppet::Node::Facts::Puppetdb < Puppet::Indirector::REST
|
|
13
14
|
Puppet::Util::Puppetdb::GlobalCheck.run
|
14
15
|
end
|
15
16
|
|
17
|
+
def get_trusted_info(node)
|
18
|
+
trusted = Puppet.lookup(:trusted_information) do
|
19
|
+
Puppet::Context::TrustedInformation.local(request.node)
|
20
|
+
end
|
21
|
+
trusted.to_h
|
22
|
+
end
|
23
|
+
|
16
24
|
def save(request)
|
17
25
|
profile "facts#save" do
|
18
26
|
payload = profile "Encode facts command submission payload" do
|
19
27
|
facts = request.instance.dup
|
20
28
|
facts.values = facts.strip_internal
|
21
|
-
|
29
|
+
if Puppet[:trusted_node_data]
|
30
|
+
facts.values[:trusted] = get_trusted_info(request.node)
|
31
|
+
end
|
22
32
|
{
|
23
33
|
"name" => facts.name,
|
24
34
|
"values" => facts.values,
|
25
35
|
# PDB-453: we call to_s to avoid a 'stack level too deep' error
|
26
36
|
# when we attempt to use ActiveSupport 2.3.16 on RHEL 5 with
|
27
37
|
# legacy storeconfigs.
|
28
|
-
"environment" => request.environment.to_s,
|
38
|
+
"environment" => request.options[:environment] || request.environment.to_s,
|
39
|
+
"producer-timestamp" => request.options[:producer_timestamp] || Time.now.iso8601,
|
29
40
|
}
|
30
41
|
end
|
31
42
|
|
32
|
-
submit_command(request.key, payload, CommandReplaceFacts,
|
43
|
+
submit_command(request.key, payload, CommandReplaceFacts, 3)
|
33
44
|
end
|
34
45
|
end
|
35
46
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quixoten-puppetdb-terminus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Devin Christensen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
92
92
|
version: '0'
|
93
93
|
requirements: []
|
94
94
|
rubyforge_project:
|
95
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.4.5
|
96
96
|
signing_key:
|
97
97
|
specification_version: 4
|
98
98
|
summary: PuppetDB Terminus
|