ml-puppetdb-terminus 3.2.1 → 3.2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/{puppet/lib → lib}/puppet/application/storeconfigs.rb +0 -0
  3. data/{puppet/lib → lib}/puppet/face/node/deactivate.rb +0 -0
  4. data/{puppet/lib → lib}/puppet/face/node/status.rb +0 -0
  5. data/{puppet/lib → lib}/puppet/face/storeconfigs.rb +0 -0
  6. data/{puppet/lib → lib}/puppet/indirector/catalog/puppetdb.rb +0 -0
  7. data/{puppet/lib → lib}/puppet/indirector/facts/puppetdb.rb +0 -0
  8. data/{puppet/lib → lib}/puppet/indirector/facts/puppetdb_apply.rb +0 -0
  9. data/{puppet/lib → lib}/puppet/indirector/node/puppetdb.rb +0 -0
  10. data/{puppet/lib → lib}/puppet/indirector/resource/puppetdb.rb +0 -0
  11. data/{puppet/lib → lib}/puppet/reports/puppetdb.rb +0 -0
  12. data/{puppet/lib → lib}/puppet/util/puppetdb.rb +0 -0
  13. data/{puppet/lib → lib}/puppet/util/puppetdb/char_encoding.rb +0 -0
  14. data/{puppet/lib → lib}/puppet/util/puppetdb/command.rb +0 -0
  15. data/{puppet/lib → lib}/puppet/util/puppetdb/command_names.rb +0 -0
  16. data/{puppet/lib → lib}/puppet/util/puppetdb/config.rb +0 -0
  17. data/{puppet/lib → lib}/puppet/util/puppetdb/http.rb +0 -0
  18. metadata +17 -48
  19. data/puppet/spec/README.markdown +0 -8
  20. data/puppet/spec/spec.opts +0 -6
  21. data/puppet/spec/spec_helper.rb +0 -38
  22. data/puppet/spec/unit/face/node/deactivate_spec.rb +0 -28
  23. data/puppet/spec/unit/face/node/status_spec.rb +0 -43
  24. data/puppet/spec/unit/face/storeconfigs_spec.rb +0 -199
  25. data/puppet/spec/unit/indirector/catalog/puppetdb_spec.rb +0 -703
  26. data/puppet/spec/unit/indirector/facts/puppetdb_apply_spec.rb +0 -27
  27. data/puppet/spec/unit/indirector/facts/puppetdb_spec.rb +0 -347
  28. data/puppet/spec/unit/indirector/node/puppetdb_spec.rb +0 -61
  29. data/puppet/spec/unit/indirector/resource/puppetdb_spec.rb +0 -199
  30. data/puppet/spec/unit/reports/puppetdb_spec.rb +0 -249
  31. data/puppet/spec/unit/util/puppetdb/char_encoding_spec.rb +0 -212
  32. data/puppet/spec/unit/util/puppetdb/command_spec.rb +0 -98
  33. data/puppet/spec/unit/util/puppetdb/config_spec.rb +0 -227
  34. data/puppet/spec/unit/util/puppetdb/http_spec.rb +0 -138
  35. data/puppet/spec/unit/util/puppetdb_spec.rb +0 -33
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef75c6961820a8af14d7f7c7df0d110a3f28544c
4
- data.tar.gz: ed6ce43fc58279145053a35975a24a0eefac5a1c
3
+ metadata.gz: 78f71318d2680406c718bf146bc777d0a627a883
4
+ data.tar.gz: 7913086e2e2e49501fac02e9214a8d163e7711b5
5
5
  SHA512:
6
- metadata.gz: 6b4c36e098603516c63d2c7318cc6fae7f515832e4f7a9bd8814e264414d15a39971b004ad3a12ab635aa0ed227d5bfd3489d95f442c7165432ac9c4cfa9cc26
7
- data.tar.gz: e8faa791156b9ae069859c3e61f3bea79cfd6b1520b55bcb7f9b42406e148fc3e5388d47664fda3b07257a35f2aa7d109faa7e5c486f8ddc445d683f9ed948e7
6
+ metadata.gz: 8fc6bcddb0f083de2544412b0f30e4a7c7abcff6ab815494af881495ff0b85ede1171df7a7f00570d6a4d4f5e12554dda4a7a01709284f54bedf48c6921b7b7f
7
+ data.tar.gz: cb291f8180d4c9894af37f10cc0e7dd5c3aeb747ae0530e3ec15e6cbd9ac43af60e62dbad5cc355f3c695f04510e9e2f95e5e9045dbb530c11404fa152676eb0
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ml-puppetdb-terminus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Lawler
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: json
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ~>
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: puppet
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -54,39 +40,22 @@ files:
54
40
  - LICENSE.txt
55
41
  - NOTICE.txt
56
42
  - README.md
57
- - puppet/lib/puppet/application/storeconfigs.rb
58
- - puppet/lib/puppet/face/node/deactivate.rb
59
- - puppet/lib/puppet/face/node/status.rb
60
- - puppet/lib/puppet/face/storeconfigs.rb
61
- - puppet/lib/puppet/indirector/catalog/puppetdb.rb
62
- - puppet/lib/puppet/indirector/facts/puppetdb.rb
63
- - puppet/lib/puppet/indirector/facts/puppetdb_apply.rb
64
- - puppet/lib/puppet/indirector/node/puppetdb.rb
65
- - puppet/lib/puppet/indirector/resource/puppetdb.rb
66
- - puppet/lib/puppet/reports/puppetdb.rb
67
- - puppet/lib/puppet/util/puppetdb.rb
68
- - puppet/lib/puppet/util/puppetdb/char_encoding.rb
69
- - puppet/lib/puppet/util/puppetdb/command.rb
70
- - puppet/lib/puppet/util/puppetdb/command_names.rb
71
- - puppet/lib/puppet/util/puppetdb/config.rb
72
- - puppet/lib/puppet/util/puppetdb/http.rb
73
- - puppet/spec/README.markdown
74
- - puppet/spec/spec.opts
75
- - puppet/spec/spec_helper.rb
76
- - puppet/spec/unit/face/node/deactivate_spec.rb
77
- - puppet/spec/unit/face/node/status_spec.rb
78
- - puppet/spec/unit/face/storeconfigs_spec.rb
79
- - puppet/spec/unit/indirector/catalog/puppetdb_spec.rb
80
- - puppet/spec/unit/indirector/facts/puppetdb_apply_spec.rb
81
- - puppet/spec/unit/indirector/facts/puppetdb_spec.rb
82
- - puppet/spec/unit/indirector/node/puppetdb_spec.rb
83
- - puppet/spec/unit/indirector/resource/puppetdb_spec.rb
84
- - puppet/spec/unit/reports/puppetdb_spec.rb
85
- - puppet/spec/unit/util/puppetdb/char_encoding_spec.rb
86
- - puppet/spec/unit/util/puppetdb/command_spec.rb
87
- - puppet/spec/unit/util/puppetdb/config_spec.rb
88
- - puppet/spec/unit/util/puppetdb/http_spec.rb
89
- - puppet/spec/unit/util/puppetdb_spec.rb
43
+ - lib/puppet/application/storeconfigs.rb
44
+ - lib/puppet/face/node/deactivate.rb
45
+ - lib/puppet/face/node/status.rb
46
+ - lib/puppet/face/storeconfigs.rb
47
+ - lib/puppet/indirector/catalog/puppetdb.rb
48
+ - lib/puppet/indirector/facts/puppetdb.rb
49
+ - lib/puppet/indirector/facts/puppetdb_apply.rb
50
+ - lib/puppet/indirector/node/puppetdb.rb
51
+ - lib/puppet/indirector/resource/puppetdb.rb
52
+ - lib/puppet/reports/puppetdb.rb
53
+ - lib/puppet/util/puppetdb.rb
54
+ - lib/puppet/util/puppetdb/char_encoding.rb
55
+ - lib/puppet/util/puppetdb/command.rb
56
+ - lib/puppet/util/puppetdb/command_names.rb
57
+ - lib/puppet/util/puppetdb/config.rb
58
+ - lib/puppet/util/puppetdb/http.rb
90
59
  homepage: https://github.com/marklawler/ml-puppetdb-terminus
91
60
  licenses:
92
61
  - Apache-2.0
@@ -1,8 +0,0 @@
1
- NOTE
2
- ====
3
-
4
- This project's specs depend on puppet core, and thus they require the
5
- puppetlabs_spec_helper project. For more information please see the
6
- README in that project, which can be found here:
7
-
8
- https://github.com/puppetlabs/puppetlabs_spec_helper
@@ -1,6 +0,0 @@
1
- --format
2
- s
3
- --colour
4
- --loadby
5
- mtime
6
- --backtrace
@@ -1,38 +0,0 @@
1
- dir = File.expand_path(File.dirname(__FILE__))
2
- $LOAD_PATH.unshift File.join(dir, "../lib")
3
- # Maybe puppetlabs_spec_helper is in a directory next to puppetdb. If not, we
4
- # don't fail any worse than we already would.
5
- $LOAD_PATH.push File.join(dir, "../../../puppetlabs_spec_helper")
6
-
7
- require 'rspec'
8
- require 'rspec/expectations'
9
- require 'puppetlabs_spec_helper/puppet_spec_helper'
10
- require 'tmpdir'
11
- require 'fileutils'
12
- require 'puppet'
13
- require 'puppet/util/puppetdb'
14
- require 'puppet/util/log'
15
-
16
- def create_environmentdir(environment)
17
- if not Puppet::Util::Puppetdb.puppet3compat?
18
- envdir = File.join(Puppet[:environmentpath], environment)
19
- if not Dir.exists?(envdir)
20
- Dir.mkdir(envdir)
21
- end
22
- end
23
- end
24
-
25
- RSpec.configure do |config|
26
-
27
- config.before :each do
28
- @logs = []
29
- Puppet::Util::Log.level = :info
30
- Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
31
-
32
- def test_logs
33
- @logs.map(&:message)
34
- end
35
-
36
- end
37
-
38
- end
@@ -1,28 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'spec_helper'
4
- require 'puppet/face'
5
- require 'puppet/indirector/node/puppetdb'
6
-
7
- describe "node face: deactivate" do
8
- let(:subject) { Puppet::Face[:node, :current] }
9
-
10
- it "should fail if no node is given" do
11
- expect { subject.deactivate }.to raise_error ArgumentError, /provide at least one node/
12
- end
13
-
14
- it "should deactivate each node using the puppetdb terminus" do
15
- nodes = ['a', 'b', 'c']
16
- nodes.each do |node|
17
- Puppet::Node::Puppetdb.any_instance.expects(:destroy).with do |request|
18
- request.key == node
19
- end.returns('uuid' => "uuid_#{node}")
20
- end
21
-
22
- subject.deactivate(*nodes).should == {
23
- 'a' => 'uuid_a',
24
- 'b' => 'uuid_b',
25
- 'c' => 'uuid_c',
26
- }
27
- end
28
- end
@@ -1,43 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'spec_helper'
4
- require 'puppet'
5
- require 'puppet/face'
6
- require 'puppet/network/http_pool'
7
-
8
- describe "node face: status" do
9
- let(:subject) { Puppet::Face[:node, :current] }
10
- let(:headers) do
11
- {
12
- "Accept" => "application/json",
13
- "Content-Type" => "application/x-www-form-urlencoded; charset=UTF-8",
14
- }
15
- end
16
-
17
- it "should fail if no node is given" do
18
- expect { subject.status }.to raise_error ArgumentError, /provide at least one node/
19
- end
20
-
21
- it "should fetch the status of each node" do
22
- http = stub 'http'
23
- Puppet::Network::HttpPool.stubs(:http_instance).returns(http)
24
-
25
- nodes = %w[a b c d e]
26
- nodes.each do |node|
27
- http.expects(:get).with("/pdb/query/v4/nodes/#{node}", headers)
28
- end
29
-
30
- subject.status(*nodes)
31
- end
32
-
33
- it "should CGI escape the node names" do
34
- http = stub 'http'
35
- Puppet::Network::HttpPool.stubs(:http_instance).returns(http)
36
-
37
- node = "foo/+*&bar"
38
-
39
- http.expects(:get).with("/pdb/query/v4/nodes/foo%2F%2B%2A%26bar", headers)
40
-
41
- subject.status(node)
42
- end
43
- end
@@ -1,199 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'puppet/util/puppetdb'
4
-
5
- if Puppet::Util::Puppetdb.puppet3compat?
6
- require 'spec_helper'
7
- require 'puppet/face/storeconfigs'
8
- require 'json'
9
- require 'puppet/util/feature'
10
- require 'puppet/util/puppetdb'
11
-
12
- describe Puppet::Face[:storeconfigs, '0.0.1'], :if => (Puppet.features.rails? && Puppet.features.sqlite?) do
13
- def setup_scratch_database
14
- Puppet::Rails.stubs(:database_arguments).returns(
15
- :adapter => 'sqlite3',
16
- :log_level => Puppet[:rails_loglevel],
17
- :database => ':memory:'
18
- )
19
- Puppet[:railslog] = '/dev/null'
20
- Puppet::Rails.init
21
- end
22
-
23
- before :all do
24
- # We have to have this block to require this file, so they get loaded on
25
- # platforms where we are going to run the tests, but not on Ruby 1.8.5.
26
- # Unfortunately, rspec will evaluate the describe block (but not the before
27
- # block or tests) even if the conditions fail. The lack of a sqlite3 gem
28
- # for Ruby 1.8.5 ensures that the condition will always be false on Ruby
29
- # 1.8.5, so at this point it's safe to require this.
30
- require 'puppet/indirector/catalog/active_record'
31
- end
32
-
33
- before :each do
34
- setup_scratch_database
35
- Puppet[:storeconfigs] = true
36
- Puppet[:storeconfigs_backend] = :active_record
37
- end
38
-
39
- describe "export action" do
40
- after :each do
41
- FileUtils.rm_rf(@path)
42
- end
43
-
44
- before :each do
45
- tempfile = Tempfile.new('export')
46
- @path = tempfile.path
47
- tempfile.close!
48
-
49
- Dir.mkdir(@path)
50
-
51
- subject.stubs(:destination_file).returns File.join(@path, 'storeconfigs-test.tar')
52
- end
53
-
54
- # Turn the filename of a gzipped tar into a hash from filename to content.
55
- def tgz_to_hash(filename)
56
- # List the files in the archive, ignoring directories (whose names end
57
- # with /), and stripping the leading puppetdb-bak.
58
- files = `tar tf #{filename}`.lines.map(&:chomp).reject { |fname| fname[-1,1] == '/'}.map {|fname| fname.sub('puppetdb-bak/', '') }
59
-
60
- # Get the content of the files, one per line. Thank goodness they're a
61
- # single line each.
62
- content = `tar xf #{filename} -O`.lines.to_a
63
-
64
- # Build a hash from filename to content. Ruby 1.8.5 doesn't like
65
- # Hash[array_of_pairs], so we have to jump through hoops by flattening
66
- # and splatting this list.
67
- Hash[*files.zip(content).flatten]
68
- end
69
-
70
- describe "with nodes present" do
71
- def notify(title, exported=false)
72
- Puppet::Resource.new(:notify, title, :parameters => {:message => title}, :exported => exported)
73
- end
74
-
75
- def user(name)
76
- Puppet::Resource.new(:user, name,
77
- :parameters => {:groups => ['foo', 'bar', 'baz'],
78
- :profiles => ['stuff', 'here'] #<-- Uses an ordered list
79
- }, :exported => true)
80
- end
81
-
82
- def save_catalog(catalog)
83
- request = Puppet::Resource::Catalog.indirection.request(:save, catalog.name, catalog)
84
- Puppet::Resource::Catalog::ActiveRecord.new.save(request)
85
- end
86
-
87
- before :each do
88
- catalog = Puppet::Resource::Catalog.new('foo')
89
-
90
- catalog.add_resource notify('not exported')
91
- catalog.add_resource notify('exported', true)
92
- catalog.add_resource user('someuser')
93
- save_catalog(catalog)
94
- end
95
-
96
- it "should have the right structure" do
97
- filename = subject.export
98
-
99
- results = tgz_to_hash(filename)
100
-
101
- results.keys.should =~ ['export-metadata.json', 'catalogs/foo.json']
102
-
103
- metadata = JSON.load(results['export-metadata.json'])
104
-
105
- metadata.keys.should =~ ['timestamp', 'command_versions']
106
- metadata['command_versions'].should == {'replace_catalog' => 6}
107
-
108
- catalog = JSON.load(results['catalogs/foo.json'])
109
-
110
- catalog.keys.should =~ ['metadata', 'environment', 'certname', 'version', 'edges', 'resources', 'timestamp', 'producer_timestamp']
111
-
112
- catalog['metadata'].should == {'api_version' => 1}
113
-
114
- catalog['certname'].should == 'foo'
115
- catalog['edges'].to_set.should == [{
116
- 'source' => {'type' => 'Stage', 'title' => 'main'},
117
- 'target' => {'type' => 'Notify', 'title' => 'exported'},
118
- 'relationship' => 'contains'},
119
- {"source"=>{"type"=>"Stage", "title"=>"main"},
120
- "target"=>{"type"=>"User", "title"=>"someuser"},
121
- "relationship"=>"contains"}].to_set
122
-
123
- catalog['resources'].should include({
124
- 'type' => 'Stage',
125
- 'title' => 'main',
126
- 'exported' => false,
127
- 'tags' => ['stage', 'main'],
128
- 'parameters' => {},
129
- })
130
-
131
- catalog['resources'].should include({
132
- 'type' => 'Notify',
133
- 'title' => 'exported',
134
- 'exported' => true,
135
- 'tags' => ['exported', 'notify'],
136
- 'parameters' => {
137
- 'message' => 'exported',
138
- },
139
- })
140
-
141
- catalog['resources'].should include({
142
- 'type' => 'User',
143
- 'title' => 'someuser',
144
- 'exported' => true,
145
- 'tags' => ['someuser', 'user'],
146
- 'parameters' => {
147
- 'groups' => ['foo', 'bar', 'baz'],
148
- 'profiles' => ['stuff', 'here']
149
- },
150
- })
151
- end
152
-
153
- it "should only include exported resources and Stage[main]" do
154
- filename = subject.export
155
-
156
- results = tgz_to_hash(filename)
157
-
158
- results.keys.should =~ ['export-metadata.json', 'catalogs/foo.json']
159
-
160
- catalog = JSON.load(results['catalogs/foo.json'])
161
-
162
- catalog['certname'].should == 'foo'
163
-
164
- catalog['edges'].map do |edge|
165
- [edge['source']['type'], edge['source']['title'], edge['relationship'], edge['target']['type'], edge['target']['title']]
166
- end.to_set.should == [['Stage', 'main', 'contains', 'Notify', 'exported'],
167
- ['Stage', 'main', 'contains', 'User', 'someuser']].to_set
168
-
169
- catalog['resources'].map { |resource| [resource['type'], resource['title']] }.to_set.should == [['Notify', 'exported'], ["User", "someuser"], ['Stage', 'main']].to_set
170
-
171
- notify = catalog['resources'].find {|resource| resource['type'] == 'Notify'}
172
-
173
- notify['exported'].should == true
174
- end
175
-
176
- it "should exclude nodes with no exported resources" do
177
- catalog = Puppet::Resource::Catalog.new('bar')
178
-
179
- catalog.add_resource notify('also not exported')
180
-
181
- save_catalog(catalog)
182
-
183
- filename = subject.export
184
-
185
- results = tgz_to_hash(filename)
186
-
187
- results.keys.should =~ ['export-metadata.json', 'catalogs/foo.json']
188
- end
189
- end
190
-
191
- it "should do nothing if there are no nodes" do
192
- filename = subject.export
193
-
194
- results = tgz_to_hash(filename)
195
- results.keys.should == ['export-metadata.json']
196
- end
197
- end
198
- end
199
- end