puppet-herald 0.2.0 → 0.8.0
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.
- checksums.yaml +5 -13
- data/.gitignore +3 -0
- data/.jshintrc +19 -0
- data/Gemfile +25 -12
- data/Gemfile.local.example +3 -0
- data/Guardfile +57 -0
- data/README.md +1 -1
- data/Rakefile +100 -20
- data/db/migrate/20141218200108_remove_no_of_reports_from_nodes.rb +7 -0
- data/lib/puppet-herald.rb +95 -65
- data/lib/puppet-herald/app/api.rb +79 -12
- data/lib/puppet-herald/app/configuration.rb +47 -15
- data/lib/puppet-herald/app/frontend.rb +6 -6
- data/lib/puppet-herald/app/views/app.erb +14 -20
- data/lib/puppet-herald/app/views/err500.erb +8 -5
- data/lib/puppet-herald/application.rb +9 -1
- data/lib/puppet-herald/cli.rb +5 -11
- data/lib/puppet-herald/database.rb +1 -7
- data/lib/puppet-herald/javascript.rb +16 -10
- data/lib/puppet-herald/models.rb +47 -0
- data/lib/puppet-herald/models/log-entry.rb +2 -0
- data/lib/puppet-herald/models/node.rb +49 -2
- data/lib/puppet-herald/models/report.rb +33 -9
- data/lib/puppet-herald/project.js +46 -0
- data/lib/puppet-herald/public/app.js +11 -9
- data/lib/puppet-herald/public/bower.json +10 -3
- data/lib/puppet-herald/public/components/artifact/artifact-directive.js +4 -0
- data/lib/puppet-herald/public/components/artifact/artifact.js +1 -3
- data/lib/puppet-herald/public/components/directives/directives.js +5 -1
- data/lib/puppet-herald/public/components/directives/status-button.html +1 -1
- data/lib/puppet-herald/public/components/directives/status-button.js +11 -11
- data/lib/puppet-herald/public/components/filters/filters.js +6 -2
- data/lib/puppet-herald/public/components/page.js +2 -2
- data/lib/puppet-herald/public/components/pagination.js +142 -0
- data/lib/puppet-herald/public/components/settings.js +25 -0
- data/lib/puppet-herald/public/css/herald.css +100 -3
- data/lib/puppet-herald/public/general/app.html +73 -0
- data/lib/puppet-herald/public/img/shield97-white.svg +53 -0
- data/lib/puppet-herald/public/img/shield97.png +0 -0
- data/lib/puppet-herald/public/node/node.html +27 -9
- data/lib/puppet-herald/public/node/node.js +43 -15
- data/lib/puppet-herald/public/nodes/nodes.html +25 -7
- data/lib/puppet-herald/public/nodes/nodes.js +29 -14
- data/lib/puppet-herald/public/report/report.html +60 -13
- data/lib/puppet-herald/public/report/report.js +21 -14
- data/lib/puppet-herald/public/router.js +55 -0
- data/lib/puppet-herald/purgecronjob.rb +35 -0
- data/lib/puppet-herald/version.rb +2 -2
- data/package.json +14 -16
- data/puppet-herald.gemspec +12 -7
- data/spec/integration/app/configuration_spec.rb +33 -0
- data/spec/integration/application_spec.rb +139 -20
- data/spec/integration/fixtures/nodes.yml +13 -0
- data/spec/integration/fixtures/pending-notify.yaml +346 -0
- data/spec/integration/fixtures/reports.yml +61 -0
- data/spec/integration/models/node_spec.rb +12 -3
- data/spec/integration/models/report_spec.rb +60 -4
- data/spec/spec_helper.rb +6 -10
- data/spec/support/active_record.rb +1 -0
- data/spec/support/fixtures.rb +16 -0
- data/spec/unit/puppet-herald/cli_spec.rb +4 -4
- data/spec/unit/puppet-herald/database_spec.rb +5 -3
- data/spec/unit/puppet-herald/purgecronjob_spec.rb +37 -0
- data/test/javascript/.bowerrc +3 -0
- data/test/javascript/bower.json +21 -0
- data/test/javascript/karma.conf.js +17 -22
- data/test/javascript/src/app_test.js +10 -61
- data/test/javascript/src/components/directives/status-button_test.js +10 -10
- data/test/javascript/src/components/paginate_test.js +183 -0
- data/test/javascript/src/node/node_test.js +16 -6
- data/test/javascript/src/nodes/nodes_test.js +14 -2
- data/test/javascript/src/report/report_test.js +6 -6
- data/test/javascript/src/router_test.js +79 -0
- metadata +642 -23
|
@@ -14,9 +14,9 @@ module PuppetHerald
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
# Version for Herald
|
|
17
|
-
VERSION = version_prep '0.
|
|
17
|
+
VERSION = version_prep '0.8.0'
|
|
18
18
|
# Lincense for Herald
|
|
19
|
-
LICENSE = 'Apache
|
|
19
|
+
LICENSE = 'Apache-2.0'
|
|
20
20
|
# Project name
|
|
21
21
|
NAME = 'Puppet Herald'
|
|
22
22
|
# Package (gem) for Herald
|
data/package.json
CHANGED
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "puppet-herald",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Provides a gateway for consuming puppet reports, a REST API and a simple Web app to display reports.",
|
|
5
5
|
"main": "lib/puppet-herald/public/app.js",
|
|
6
6
|
"directories": {
|
|
7
7
|
"test": "test"
|
|
8
8
|
},
|
|
9
|
-
"dependencies": {
|
|
10
|
-
"angular": "1.3.x",
|
|
11
|
-
"angular-route": "1.3.x",
|
|
12
|
-
"moment": "~2.8",
|
|
13
|
-
"angular-moment": "~0.8"
|
|
14
|
-
},
|
|
9
|
+
"dependencies": {},
|
|
15
10
|
"devDependencies": {
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
11
|
+
"bower": "~1.4.0",
|
|
12
|
+
"coveralls": "~2.11.0",
|
|
13
|
+
"globby": "~2.0.0",
|
|
14
|
+
"jasmine-core": "~2.2.0",
|
|
20
15
|
"karma": "~0.12.0",
|
|
21
|
-
"
|
|
22
|
-
"karma-
|
|
23
|
-
"karma-
|
|
16
|
+
"karma-coverage": "~0.2",
|
|
17
|
+
"karma-jasmine": "~0.3.0",
|
|
18
|
+
"karma-ng-html2js-preprocessor": "~0.1",
|
|
24
19
|
"karma-phantomjs-launcher": "~0.1",
|
|
25
|
-
"karma-
|
|
20
|
+
"karma-story-reporter": "~0.3",
|
|
21
|
+
"lcov-result-merger": "~1.0.0",
|
|
22
|
+
"phantomjs": "~1.9.0",
|
|
23
|
+
"wiredep": "~2.2.2"
|
|
26
24
|
},
|
|
27
25
|
"scripts": {
|
|
28
26
|
"test": "test/javascript/karma.conf.js"
|
|
@@ -37,7 +35,7 @@
|
|
|
37
35
|
"herald"
|
|
38
36
|
],
|
|
39
37
|
"author": "Krzysztof Suszynski",
|
|
40
|
-
"license": "Apache
|
|
38
|
+
"license": "Apache-2.0",
|
|
41
39
|
"bugs": {
|
|
42
40
|
"url": "https://github.com/wavesoftware/gem-puppet-herald/issues"
|
|
43
41
|
},
|
data/puppet-herald.gemspec
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
ROOT = Pathname.new(File.expand_path('../', __FILE__))
|
|
4
|
+
LIB = Pathname.new('lib/puppet-herald')
|
|
5
|
+
ph = ROOT.join(LIB)
|
|
6
|
+
require ph.join('version')
|
|
4
7
|
|
|
5
8
|
Gem::Specification.new do |gem|
|
|
9
|
+
deps = Dir.glob(LIB.join('public').join('bower_components').join('**/*'))
|
|
6
10
|
gem.name = PuppetHerald::PACKAGE
|
|
7
11
|
gem.version = PuppetHerald::VERSION
|
|
8
12
|
gem.author = 'Krzysztof Suszynski'
|
|
@@ -13,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
|
13
17
|
gem.description = PuppetHerald::DESCRIPTION
|
|
14
18
|
|
|
15
19
|
gem.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
16
|
-
gem.files = `git ls-files`.split("\n")
|
|
20
|
+
gem.files = `git ls-files`.split("\n").concat(deps)
|
|
17
21
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
18
22
|
gem.require_paths = ['lib']
|
|
19
23
|
|
|
@@ -21,11 +25,12 @@ Gem::Specification.new do |gem|
|
|
|
21
25
|
gem.required_ruby_version = '>= 1.9.2'
|
|
22
26
|
|
|
23
27
|
# Runtime
|
|
24
|
-
gem.add_runtime_dependency 'sinatra', '~> 1.4'
|
|
25
|
-
gem.add_runtime_dependency 'sinatra-contrib', '~> 1.4'
|
|
26
|
-
gem.add_runtime_dependency 'sinatra-activerecord', '~> 2.0'
|
|
27
|
-
gem.add_runtime_dependency '
|
|
28
|
-
gem.add_runtime_dependency '
|
|
28
|
+
gem.add_runtime_dependency 'sinatra', '~> 1.4', '>= 1.4.0'
|
|
29
|
+
gem.add_runtime_dependency 'sinatra-contrib', '~> 1.4', '>= 1.4.0'
|
|
30
|
+
gem.add_runtime_dependency 'sinatra-activerecord', '~> 2.0', '>= 2.0.0'
|
|
31
|
+
gem.add_runtime_dependency 'rufus-scheduler', '~> 3.0', '>= 3.0.0'
|
|
32
|
+
gem.add_runtime_dependency 'micro-optparse', '~> 1.2', '>= 1.2.0'
|
|
33
|
+
gem.add_runtime_dependency 'uglifier', '~> 2.7', '>= 2.7.0'
|
|
29
34
|
end
|
|
30
35
|
|
|
31
36
|
# vim:ft=ruby
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'model_helper'
|
|
2
|
+
require 'puppet-herald/app/configuration'
|
|
3
|
+
|
|
4
|
+
describe PuppetHerald::App::Configuration do
|
|
5
|
+
after(:all) do
|
|
6
|
+
PuppetHerald.environment = :test
|
|
7
|
+
end
|
|
8
|
+
describe '.setup_database_logger' do
|
|
9
|
+
subject { PuppetHerald::App::Configuration.configure_app(dbmigrate: false, cron: false) }
|
|
10
|
+
context 'in DEV environment' do
|
|
11
|
+
before(:each) do
|
|
12
|
+
PuppetHerald.environment = :development
|
|
13
|
+
end
|
|
14
|
+
it 'executes properlly' do
|
|
15
|
+
expect(subject).to be_nil
|
|
16
|
+
end
|
|
17
|
+
it 'sets logger level to DEBUG' do
|
|
18
|
+
expect(ActiveRecord::Base.logger.level).to eq(Logger::DEBUG)
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
context 'in PROD environment' do
|
|
22
|
+
before(:each) do
|
|
23
|
+
PuppetHerald.environment = :production
|
|
24
|
+
end
|
|
25
|
+
it 'executes properlly' do
|
|
26
|
+
expect(subject).to be_nil
|
|
27
|
+
end
|
|
28
|
+
it 'sets logger level to INFO' do
|
|
29
|
+
expect(ActiveRecord::Base.logger.level).to eq(Logger::INFO)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
ENV['RACK_ENV'] = 'test'
|
|
2
2
|
|
|
3
|
-
require '
|
|
4
|
-
require 'spec_helper'
|
|
3
|
+
require 'model_helper'
|
|
5
4
|
require 'rspec'
|
|
6
5
|
require 'rack/test'
|
|
7
6
|
|
|
8
|
-
shared_examples 'a redirect to
|
|
7
|
+
shared_examples 'a redirect to /' do
|
|
9
8
|
it { expect(subject).not_to be_successful }
|
|
10
9
|
it { expect(subject).to be_redirection }
|
|
11
10
|
it { expect(subject.status).to eq(301) }
|
|
12
|
-
it { expect(subject.header['Location']).to eq('http://example.org/
|
|
11
|
+
it { expect(subject.header['Location']).to eq('http://example.org/') }
|
|
13
12
|
end
|
|
14
13
|
|
|
15
14
|
shared_examples 'a proper 2xx - success' do
|
|
@@ -26,6 +25,12 @@ shared_examples '500 - error' do
|
|
|
26
25
|
it { expect(subject.body).not_to be_empty }
|
|
27
26
|
end
|
|
28
27
|
|
|
28
|
+
shared_examples '400 - bad request' do
|
|
29
|
+
it { expect(subject).not_to be_successful }
|
|
30
|
+
it { expect(subject).to be_client_error }
|
|
31
|
+
it { expect(subject.status).to eq 400 }
|
|
32
|
+
it { expect(subject.body).not_to be_empty }
|
|
33
|
+
end
|
|
29
34
|
shared_examples '404 - not found' do
|
|
30
35
|
it { expect(subject).not_to be_successful }
|
|
31
36
|
it { expect(subject).to be_client_error }
|
|
@@ -42,6 +47,10 @@ shared_examples "working API - not found" do
|
|
|
42
47
|
it { expect(subject.content_type).to eq 'application/json' }
|
|
43
48
|
it_behaves_like '404 - not found'
|
|
44
49
|
end
|
|
50
|
+
shared_examples "working API - bad request" do
|
|
51
|
+
it { expect(subject.content_type).to eq 'application/json' }
|
|
52
|
+
it_behaves_like '400 - bad request'
|
|
53
|
+
end
|
|
45
54
|
|
|
46
55
|
shared_examples "working API - error" do
|
|
47
56
|
it { expect(subject.content_type).to eq 'application/json' }
|
|
@@ -51,27 +60,40 @@ end
|
|
|
51
60
|
describe 'The Herald App' do
|
|
52
61
|
include Rack::Test::Methods
|
|
53
62
|
|
|
54
|
-
before(:all)
|
|
63
|
+
before(:all) do
|
|
64
|
+
reconnectdb
|
|
65
|
+
end
|
|
55
66
|
|
|
56
67
|
def app
|
|
57
68
|
require 'puppet-herald/application'
|
|
58
69
|
PuppetHerald::Application
|
|
59
70
|
end
|
|
60
71
|
|
|
61
|
-
describe "on '/
|
|
62
|
-
|
|
63
|
-
|
|
72
|
+
describe "on '/app.html'" do
|
|
73
|
+
level = nil
|
|
74
|
+
before(:all) do
|
|
75
|
+
require 'puppet-herald/app/configuration'
|
|
76
|
+
level = PuppetHerald.logger.level
|
|
77
|
+
PuppetHerald.logger.level = 100
|
|
78
|
+
PuppetHerald::App::Configuration.configure_app(dbmigrate: false)
|
|
79
|
+
end
|
|
80
|
+
after(:all) do
|
|
81
|
+
app.quit!
|
|
82
|
+
PuppetHerald.logger.level = level
|
|
83
|
+
end
|
|
84
|
+
it_behaves_like 'a redirect to /' do
|
|
85
|
+
subject { get '/app.html' }
|
|
64
86
|
end
|
|
65
87
|
end
|
|
66
88
|
|
|
67
|
-
describe "on '/index.html'
|
|
68
|
-
it_behaves_like 'a redirect to
|
|
89
|
+
describe "on '/index.html'" do
|
|
90
|
+
it_behaves_like 'a redirect to /' do
|
|
69
91
|
subject { get '/index.html' }
|
|
70
92
|
end
|
|
71
93
|
end
|
|
72
94
|
|
|
73
|
-
describe "on main page '/
|
|
74
|
-
subject { get '/
|
|
95
|
+
describe "on main page '/'" do
|
|
96
|
+
subject { get '/' }
|
|
75
97
|
context 'in production' do
|
|
76
98
|
before { expect(PuppetHerald).to receive(:in_prod?).at_least(:once).and_return true }
|
|
77
99
|
it { expect(subject.body).to include 'app.min.js' }
|
|
@@ -106,7 +128,7 @@ describe 'The Herald App' do
|
|
|
106
128
|
it { expect(subject.content_type).to eq 'application/javascript;charset=utf-8' }
|
|
107
129
|
end
|
|
108
130
|
|
|
109
|
-
describe "that
|
|
131
|
+
describe "that had received a fatal error" do
|
|
110
132
|
after :each do
|
|
111
133
|
Dir.glob(Dir.tmpdir + '/puppet-herald-bug*.log') { |file| Pathname.new(file).unlink }
|
|
112
134
|
PuppetHerald.environment = :test
|
|
@@ -133,7 +155,7 @@ describe 'The Herald App' do
|
|
|
133
155
|
before :each do
|
|
134
156
|
expect_any_instance_of(PuppetHerald::App::LogicImpl).to receive(:app_html).and_raise :expected
|
|
135
157
|
end
|
|
136
|
-
subject { get '/
|
|
158
|
+
subject { get '/' }
|
|
137
159
|
context 'in production environment' do
|
|
138
160
|
before { PuppetHerald.environment = :production }
|
|
139
161
|
it_behaves_like '500 - error'
|
|
@@ -152,19 +174,116 @@ describe 'The Herald App' do
|
|
|
152
174
|
|
|
153
175
|
before :each do
|
|
154
176
|
reconnectdb
|
|
177
|
+
fixtures :nodes
|
|
178
|
+
fixtures :reports
|
|
155
179
|
end
|
|
156
180
|
describe "post '/api/v1/reports'" do
|
|
157
181
|
let(:yaml) { File.read(File.expand_path("../fixtures/changed-notify.yaml", __FILE__)) }
|
|
158
182
|
subject { post '/api/v1/reports', yaml }
|
|
159
183
|
it_behaves_like 'working API - success'
|
|
160
184
|
end
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
185
|
+
context 'without pagination' do
|
|
186
|
+
describe "get '/api/v1/nodes'" do
|
|
187
|
+
subject { get '/api/v1/nodes' }
|
|
188
|
+
let(:json) { JSON.parse subject.body }
|
|
189
|
+
it_behaves_like 'working API - success'
|
|
190
|
+
it { expect(json.size).to be(2) }
|
|
191
|
+
end
|
|
192
|
+
describe "get '/api/v1/nodes/1'" do
|
|
193
|
+
subject { get '/api/v1/nodes/1' }
|
|
194
|
+
let(:json) { JSON.parse subject.body }
|
|
195
|
+
it_behaves_like 'working API - success'
|
|
196
|
+
it { expect(json['reports'].class).to be(Array) }
|
|
197
|
+
it { expect(json['reports'].size).to be(5) }
|
|
198
|
+
end
|
|
199
|
+
describe "get '/api/v1/nodes/12'" do
|
|
200
|
+
subject { get '/api/v1/nodes/12' }
|
|
201
|
+
it_behaves_like 'working API - not found'
|
|
202
|
+
end
|
|
164
203
|
end
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
204
|
+
context 'with pagination given' do
|
|
205
|
+
let(:compile_headers) do
|
|
206
|
+
lambda do |pag|
|
|
207
|
+
api = PuppetHerald::App::ApiImplV1.new(nil)
|
|
208
|
+
api.send(:headers, pag, true)
|
|
209
|
+
end
|
|
210
|
+
end
|
|
211
|
+
context 'with page 1 and limit 10' do
|
|
212
|
+
let(:headers) { compile_headers.call(PuppetHerald::Models::Pagination.new(1, 10)) }
|
|
213
|
+
describe "get '/api/v1/nodes'" do
|
|
214
|
+
subject { get('/api/v1/nodes', {}, headers) }
|
|
215
|
+
let(:json) { JSON.parse subject.body }
|
|
216
|
+
it_behaves_like 'working API - success'
|
|
217
|
+
it { expect(json.size).to be(2) }
|
|
218
|
+
it { expect(json[0]['no_of_reports']).to eq(5) }
|
|
219
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:page] => '1') }
|
|
220
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:limit] => '10') }
|
|
221
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:total] => '2') }
|
|
222
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:pages] => '1') }
|
|
223
|
+
end
|
|
224
|
+
describe "get '/api/v1/nodes/1'" do
|
|
225
|
+
subject { get('/api/v1/nodes/1', {}, headers) }
|
|
226
|
+
let(:json) { JSON.parse subject.body }
|
|
227
|
+
it_behaves_like 'working API - success'
|
|
228
|
+
it { expect(json['reports'].class).to be(Array) }
|
|
229
|
+
it { expect(json['reports'].size).to be(5) }
|
|
230
|
+
it { expect(json['no_of_reports']).to eq(5) }
|
|
231
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:page] => '1') }
|
|
232
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:limit] => '10') }
|
|
233
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:total] => '5') }
|
|
234
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:pages] => '1') }
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
context 'with page 2 and limit 1' do
|
|
238
|
+
let(:headers) { compile_headers.call(PuppetHerald::Models::Pagination.new(2, 1)) }
|
|
239
|
+
describe "get '/api/v1/nodes'" do
|
|
240
|
+
subject { get('/api/v1/nodes', {}, headers) }
|
|
241
|
+
let(:json) { JSON.parse subject.body }
|
|
242
|
+
it_behaves_like 'working API - success'
|
|
243
|
+
it { expect(json.size).to be(1) }
|
|
244
|
+
it { expect(json[0]['name']).to eq('slave1.vm') }
|
|
245
|
+
it { expect(json[0]['no_of_reports']).to eq(0) }
|
|
246
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:page] => '2') }
|
|
247
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:limit] => '1') }
|
|
248
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:total] => '2') }
|
|
249
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:pages] => '2') }
|
|
250
|
+
end
|
|
251
|
+
describe "get '/api/v1/nodes/1'" do
|
|
252
|
+
subject { get('/api/v1/nodes/1', {}, headers) }
|
|
253
|
+
let(:json) { JSON.parse subject.body }
|
|
254
|
+
it_behaves_like 'working API - success'
|
|
255
|
+
it { expect(json['reports'].class).to be(Array) }
|
|
256
|
+
it { expect(json['reports'].size).to be(1) }
|
|
257
|
+
it { expect(json['no_of_reports']).to eq(5) }
|
|
258
|
+
it { expect(json['reports'][0]['configuration_version']).to eq('12345721') }
|
|
259
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:page] => '2') }
|
|
260
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:limit] => '1') }
|
|
261
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:total] => '5') }
|
|
262
|
+
it { expect(subject.headers).to include(PuppetHerald::Models::Pagination::KEYS[:pages] => '5') }
|
|
263
|
+
end
|
|
264
|
+
end
|
|
265
|
+
context 'with page -12 and limit 2' do
|
|
266
|
+
let(:headers) do
|
|
267
|
+
api = PuppetHerald::App::ApiImplV1.new(nil)
|
|
268
|
+
httpize = lambda {|name| api.send(:httpize, name) }
|
|
269
|
+
{
|
|
270
|
+
httpize.call(PuppetHerald::Models::Pagination::KEYS[:page]) => '-12',
|
|
271
|
+
httpize.call(PuppetHerald::Models::Pagination::KEYS[:limit]) => '2'
|
|
272
|
+
}
|
|
273
|
+
end
|
|
274
|
+
describe "get '/api/v1/nodes'" do
|
|
275
|
+
subject { get('/api/v1/nodes', {}, headers) }
|
|
276
|
+
let(:json) { JSON.parse subject.body }
|
|
277
|
+
it_behaves_like 'working API - bad request'
|
|
278
|
+
it { expect(json['error']).to eq('ArgumentError: Invalid value for pagination page "-12"') }
|
|
279
|
+
end
|
|
280
|
+
describe "get '/api/v1/nodes/1'" do
|
|
281
|
+
subject { get('/api/v1/nodes/1', {}, headers) }
|
|
282
|
+
let(:json) { JSON.parse subject.body }
|
|
283
|
+
it_behaves_like 'working API - bad request'
|
|
284
|
+
it { expect(json['error']).to eq('ArgumentError: Invalid value for pagination page "-12"') }
|
|
285
|
+
end
|
|
286
|
+
end
|
|
168
287
|
end
|
|
169
288
|
describe "get '/api/v1/reports/1'" do
|
|
170
289
|
subject { get '/api/v1/reports/1' }
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
--- !ruby/object:Puppet::Transaction::Report
|
|
2
|
+
metrics:
|
|
3
|
+
resources: !ruby/object:Puppet::Util::Metric
|
|
4
|
+
name: resources
|
|
5
|
+
label: Resources
|
|
6
|
+
values:
|
|
7
|
+
- - total
|
|
8
|
+
- Total
|
|
9
|
+
- 8
|
|
10
|
+
- - skipped
|
|
11
|
+
- Skipped
|
|
12
|
+
- 0
|
|
13
|
+
- - failed
|
|
14
|
+
- Failed
|
|
15
|
+
- 0
|
|
16
|
+
- - failed_to_restart
|
|
17
|
+
- "Failed to restart"
|
|
18
|
+
- 0
|
|
19
|
+
- - restarted
|
|
20
|
+
- Restarted
|
|
21
|
+
- 0
|
|
22
|
+
- - changed
|
|
23
|
+
- Changed
|
|
24
|
+
- 0
|
|
25
|
+
- - out_of_sync
|
|
26
|
+
- "Out of sync"
|
|
27
|
+
- 1
|
|
28
|
+
- - scheduled
|
|
29
|
+
- Scheduled
|
|
30
|
+
- 0
|
|
31
|
+
time: !ruby/object:Puppet::Util::Metric
|
|
32
|
+
name: time
|
|
33
|
+
label: Time
|
|
34
|
+
values:
|
|
35
|
+
- - schedule
|
|
36
|
+
- Schedule
|
|
37
|
+
- 0.000240972
|
|
38
|
+
- - notify
|
|
39
|
+
- Notify
|
|
40
|
+
- 0.000303028
|
|
41
|
+
- - filebucket
|
|
42
|
+
- Filebucket
|
|
43
|
+
- 6.039e-05
|
|
44
|
+
- - config_retrieval
|
|
45
|
+
- "Config retrieval"
|
|
46
|
+
- 0.064040677
|
|
47
|
+
- - total
|
|
48
|
+
- Total
|
|
49
|
+
- 0.064645067
|
|
50
|
+
changes: !ruby/object:Puppet::Util::Metric
|
|
51
|
+
name: changes
|
|
52
|
+
label: Changes
|
|
53
|
+
values:
|
|
54
|
+
- - total
|
|
55
|
+
- Total
|
|
56
|
+
- 0
|
|
57
|
+
events: !ruby/object:Puppet::Util::Metric
|
|
58
|
+
name: events
|
|
59
|
+
label: Events
|
|
60
|
+
values:
|
|
61
|
+
- - total
|
|
62
|
+
- Total
|
|
63
|
+
- 1
|
|
64
|
+
- - failure
|
|
65
|
+
- Failure
|
|
66
|
+
- 0
|
|
67
|
+
- - success
|
|
68
|
+
- Success
|
|
69
|
+
- 0
|
|
70
|
+
- - noop
|
|
71
|
+
- Noop
|
|
72
|
+
- 1
|
|
73
|
+
logs:
|
|
74
|
+
- !ruby/object:Puppet::Util::Log
|
|
75
|
+
level: !ruby/sym debug
|
|
76
|
+
tags:
|
|
77
|
+
- debug
|
|
78
|
+
message: "Loaded state in 0.00 seconds"
|
|
79
|
+
source: Puppet
|
|
80
|
+
time: 2015-04-08 14:20:15.877861 +02:00
|
|
81
|
+
- !ruby/object:Puppet::Util::Log
|
|
82
|
+
level: !ruby/sym info
|
|
83
|
+
tags:
|
|
84
|
+
- info
|
|
85
|
+
message: "Applying configuration version '1428495615'"
|
|
86
|
+
source: Puppet
|
|
87
|
+
time: 2015-04-08 14:20:15.878967 +02:00
|
|
88
|
+
- !ruby/object:Puppet::Util::Log
|
|
89
|
+
level: !ruby/sym notice
|
|
90
|
+
tags:
|
|
91
|
+
- notice
|
|
92
|
+
- notify
|
|
93
|
+
- class
|
|
94
|
+
message: "current_value absent, should be Notify of something (noop)"
|
|
95
|
+
source: "/Stage[main]/Main/Notify[Notify of something]/message"
|
|
96
|
+
time: 2015-04-08 14:20:15.880377 +02:00
|
|
97
|
+
file: /home/ksuszynski/tmp/notify.pp
|
|
98
|
+
line: 1
|
|
99
|
+
- !ruby/object:Puppet::Util::Log
|
|
100
|
+
level: !ruby/sym debug
|
|
101
|
+
tags:
|
|
102
|
+
- debug
|
|
103
|
+
- notify
|
|
104
|
+
- class
|
|
105
|
+
message: "The container Class[Main] will propagate my refresh event"
|
|
106
|
+
source: "/Stage[main]/Main/Notify[Notify of something]"
|
|
107
|
+
time: 2015-04-08 14:20:15.880532 +02:00
|
|
108
|
+
file: /home/ksuszynski/tmp/notify.pp
|
|
109
|
+
line: 1
|
|
110
|
+
- !ruby/object:Puppet::Util::Log
|
|
111
|
+
level: !ruby/sym notice
|
|
112
|
+
tags:
|
|
113
|
+
- notice
|
|
114
|
+
- completed_class
|
|
115
|
+
- main
|
|
116
|
+
message: "Would have triggered 'refresh' from 1 events"
|
|
117
|
+
source: Class[Main]
|
|
118
|
+
time: 2015-04-08 14:20:15.881331 +02:00
|
|
119
|
+
- !ruby/object:Puppet::Util::Log
|
|
120
|
+
level: !ruby/sym debug
|
|
121
|
+
tags:
|
|
122
|
+
- debug
|
|
123
|
+
- completed_class
|
|
124
|
+
- main
|
|
125
|
+
message: "The container Stage[main] will propagate my refresh event"
|
|
126
|
+
source: Class[Main]
|
|
127
|
+
time: 2015-04-08 14:20:15.881477 +02:00
|
|
128
|
+
- !ruby/object:Puppet::Util::Log
|
|
129
|
+
level: !ruby/sym notice
|
|
130
|
+
tags:
|
|
131
|
+
- notice
|
|
132
|
+
- completed_stage
|
|
133
|
+
- main
|
|
134
|
+
message: "Would have triggered 'refresh' from 1 events"
|
|
135
|
+
source: Stage[main]
|
|
136
|
+
time: 2015-04-08 14:20:15.881685 +02:00
|
|
137
|
+
- !ruby/object:Puppet::Util::Log
|
|
138
|
+
level: !ruby/sym debug
|
|
139
|
+
tags:
|
|
140
|
+
- debug
|
|
141
|
+
message: "Finishing transaction 39170880"
|
|
142
|
+
source: Puppet
|
|
143
|
+
time: 2015-04-08 14:20:15.881819 +02:00
|
|
144
|
+
- !ruby/object:Puppet::Util::Log
|
|
145
|
+
level: !ruby/sym debug
|
|
146
|
+
tags:
|
|
147
|
+
- debug
|
|
148
|
+
message: "Storing state"
|
|
149
|
+
source: Puppet
|
|
150
|
+
time: 2015-04-08 14:20:15.881869 +02:00
|
|
151
|
+
- !ruby/object:Puppet::Util::Log
|
|
152
|
+
level: !ruby/sym debug
|
|
153
|
+
tags:
|
|
154
|
+
- debug
|
|
155
|
+
message: "Stored state in 0.07 seconds"
|
|
156
|
+
source: Puppet
|
|
157
|
+
time: 2015-04-08 14:20:15.947269 +02:00
|
|
158
|
+
- !ruby/object:Puppet::Util::Log
|
|
159
|
+
level: !ruby/sym notice
|
|
160
|
+
tags:
|
|
161
|
+
- notice
|
|
162
|
+
message: "Finished catalog run in 0.07 seconds"
|
|
163
|
+
source: Puppet
|
|
164
|
+
time: 2015-04-08 14:20:15.947363 +02:00
|
|
165
|
+
resource_statuses:
|
|
166
|
+
Schedule[daily]: !ruby/object:Puppet::Resource::Status
|
|
167
|
+
resource: Schedule[daily]
|
|
168
|
+
file:
|
|
169
|
+
line:
|
|
170
|
+
evaluation_time: 6.3343e-05
|
|
171
|
+
change_count: 0
|
|
172
|
+
out_of_sync_count: 0
|
|
173
|
+
tags:
|
|
174
|
+
- schedule
|
|
175
|
+
- daily
|
|
176
|
+
time: 2015-04-08 14:20:15.879283 +02:00
|
|
177
|
+
events: []
|
|
178
|
+
out_of_sync: false
|
|
179
|
+
changed: false
|
|
180
|
+
resource_type: Schedule
|
|
181
|
+
title: daily
|
|
182
|
+
skipped: false
|
|
183
|
+
failed: false
|
|
184
|
+
containment_path:
|
|
185
|
+
- Schedule[daily]
|
|
186
|
+
Schedule[monthly]: !ruby/object:Puppet::Resource::Status
|
|
187
|
+
resource: Schedule[monthly]
|
|
188
|
+
file:
|
|
189
|
+
line:
|
|
190
|
+
evaluation_time: 2.982e-05
|
|
191
|
+
change_count: 0
|
|
192
|
+
out_of_sync_count: 0
|
|
193
|
+
tags:
|
|
194
|
+
- schedule
|
|
195
|
+
- monthly
|
|
196
|
+
time: 2015-04-08 14:20:15.879428 +02:00
|
|
197
|
+
events: []
|
|
198
|
+
out_of_sync: false
|
|
199
|
+
changed: false
|
|
200
|
+
resource_type: Schedule
|
|
201
|
+
title: monthly
|
|
202
|
+
skipped: false
|
|
203
|
+
failed: false
|
|
204
|
+
containment_path:
|
|
205
|
+
- Schedule[monthly]
|
|
206
|
+
Schedule[hourly]: !ruby/object:Puppet::Resource::Status
|
|
207
|
+
resource: Schedule[hourly]
|
|
208
|
+
file:
|
|
209
|
+
line:
|
|
210
|
+
evaluation_time: 2.8972e-05
|
|
211
|
+
change_count: 0
|
|
212
|
+
out_of_sync_count: 0
|
|
213
|
+
tags:
|
|
214
|
+
- schedule
|
|
215
|
+
- hourly
|
|
216
|
+
time: 2015-04-08 14:20:15.879510 +02:00
|
|
217
|
+
events: []
|
|
218
|
+
out_of_sync: false
|
|
219
|
+
changed: false
|
|
220
|
+
resource_type: Schedule
|
|
221
|
+
title: hourly
|
|
222
|
+
skipped: false
|
|
223
|
+
failed: false
|
|
224
|
+
containment_path:
|
|
225
|
+
- Schedule[hourly]
|
|
226
|
+
"Notify[Notify of something]": !ruby/object:Puppet::Resource::Status
|
|
227
|
+
resource: "Notify[Notify of something]"
|
|
228
|
+
file: /home/ksuszynski/tmp/notify.pp
|
|
229
|
+
line: 1
|
|
230
|
+
evaluation_time: 0.000303028
|
|
231
|
+
change_count: 0
|
|
232
|
+
out_of_sync_count: 1
|
|
233
|
+
tags:
|
|
234
|
+
- notify
|
|
235
|
+
- class
|
|
236
|
+
time: 2015-04-08 14:20:15.880149 +02:00
|
|
237
|
+
events:
|
|
238
|
+
- !ruby/object:Puppet::Transaction::Event
|
|
239
|
+
audited: false
|
|
240
|
+
property: message
|
|
241
|
+
previous_value: !ruby/sym absent
|
|
242
|
+
desired_value: "Notify of something"
|
|
243
|
+
historical_value:
|
|
244
|
+
message: "current_value absent, should be Notify of something (noop)"
|
|
245
|
+
name: !ruby/sym message_changed
|
|
246
|
+
status: noop
|
|
247
|
+
time: 2015-04-08 14:20:15.880328 +02:00
|
|
248
|
+
out_of_sync: true
|
|
249
|
+
changed: false
|
|
250
|
+
resource_type: Notify
|
|
251
|
+
title: "Notify of something"
|
|
252
|
+
skipped: false
|
|
253
|
+
failed: false
|
|
254
|
+
containment_path:
|
|
255
|
+
- Stage[main]
|
|
256
|
+
- Main
|
|
257
|
+
- "Notify[Notify of something]"
|
|
258
|
+
Schedule[never]: !ruby/object:Puppet::Resource::Status
|
|
259
|
+
resource: Schedule[never]
|
|
260
|
+
file:
|
|
261
|
+
line:
|
|
262
|
+
evaluation_time: 3.8885e-05
|
|
263
|
+
change_count: 0
|
|
264
|
+
out_of_sync_count: 0
|
|
265
|
+
tags:
|
|
266
|
+
- schedule
|
|
267
|
+
- never
|
|
268
|
+
time: 2015-04-08 14:20:15.880708 +02:00
|
|
269
|
+
events: []
|
|
270
|
+
out_of_sync: false
|
|
271
|
+
changed: false
|
|
272
|
+
resource_type: Schedule
|
|
273
|
+
title: never
|
|
274
|
+
skipped: false
|
|
275
|
+
failed: false
|
|
276
|
+
containment_path:
|
|
277
|
+
- Schedule[never]
|
|
278
|
+
Filebucket[puppet]: !ruby/object:Puppet::Resource::Status
|
|
279
|
+
resource: Filebucket[puppet]
|
|
280
|
+
file:
|
|
281
|
+
line:
|
|
282
|
+
evaluation_time: 6.039e-05
|
|
283
|
+
change_count: 0
|
|
284
|
+
out_of_sync_count: 0
|
|
285
|
+
tags:
|
|
286
|
+
- filebucket
|
|
287
|
+
- puppet
|
|
288
|
+
time: 2015-04-08 14:20:15.880851 +02:00
|
|
289
|
+
events: []
|
|
290
|
+
out_of_sync: false
|
|
291
|
+
changed: false
|
|
292
|
+
resource_type: Filebucket
|
|
293
|
+
title: puppet
|
|
294
|
+
skipped: false
|
|
295
|
+
failed: false
|
|
296
|
+
containment_path:
|
|
297
|
+
- Filebucket[puppet]
|
|
298
|
+
Schedule[weekly]: !ruby/object:Puppet::Resource::Status
|
|
299
|
+
resource: Schedule[weekly]
|
|
300
|
+
file:
|
|
301
|
+
line:
|
|
302
|
+
evaluation_time: 3.1912e-05
|
|
303
|
+
change_count: 0
|
|
304
|
+
out_of_sync_count: 0
|
|
305
|
+
tags:
|
|
306
|
+
- schedule
|
|
307
|
+
- weekly
|
|
308
|
+
time: 2015-04-08 14:20:15.881031 +02:00
|
|
309
|
+
events: []
|
|
310
|
+
out_of_sync: false
|
|
311
|
+
changed: false
|
|
312
|
+
resource_type: Schedule
|
|
313
|
+
title: weekly
|
|
314
|
+
skipped: false
|
|
315
|
+
failed: false
|
|
316
|
+
containment_path:
|
|
317
|
+
- Schedule[weekly]
|
|
318
|
+
Schedule[puppet]: !ruby/object:Puppet::Resource::Status
|
|
319
|
+
resource: Schedule[puppet]
|
|
320
|
+
file:
|
|
321
|
+
line:
|
|
322
|
+
evaluation_time: 4.804e-05
|
|
323
|
+
change_count: 0
|
|
324
|
+
out_of_sync_count: 0
|
|
325
|
+
tags:
|
|
326
|
+
- schedule
|
|
327
|
+
- puppet
|
|
328
|
+
time: 2015-04-08 14:20:15.881147 +02:00
|
|
329
|
+
events: []
|
|
330
|
+
out_of_sync: false
|
|
331
|
+
changed: false
|
|
332
|
+
resource_type: Schedule
|
|
333
|
+
title: puppet
|
|
334
|
+
skipped: false
|
|
335
|
+
failed: false
|
|
336
|
+
containment_path:
|
|
337
|
+
- Schedule[puppet]
|
|
338
|
+
host: ksuszynski-gs70.suszynski.org
|
|
339
|
+
time: 2015-04-08 14:20:15.867589 +02:00
|
|
340
|
+
kind: apply
|
|
341
|
+
report_format: 4
|
|
342
|
+
puppet_version: "3.7.5"
|
|
343
|
+
configuration_version: 1428495615
|
|
344
|
+
transaction_uuid: "0b093272-e2f1-471b-8610-9f4e259a4436"
|
|
345
|
+
environment: production
|
|
346
|
+
status: unchanged
|