knife-lastrun 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/knife-lastrun.gemspec +1 -1
- data/lib/chef/knife/lastrun.rb +5 -5
- data/lib/knife-lastrun/version.rb +1 -1
- data/lib/lastrun_update.rb +20 -15
- metadata +24 -41
data/knife-lastrun.gemspec
CHANGED
@@ -5,7 +5,7 @@ require "knife-lastrun/version"
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = 'knife-lastrun'
|
7
7
|
s.version = Knife::NodeLastrun::VERSION
|
8
|
-
s.date = '
|
8
|
+
s.date = '2015-08-04'
|
9
9
|
s.summary = "A plugin for Chef::Knife which displays node metadata about the last chef run."
|
10
10
|
s.description = s.summary
|
11
11
|
s.authors = ["John Goulah"]
|
data/lib/chef/knife/lastrun.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
require 'chef/node'
|
2
|
-
require 'chef/knife'
|
3
|
-
require 'highline'
|
4
|
-
|
5
1
|
module GoulahPlugins
|
6
2
|
class NodeLastrun < Chef::Knife
|
7
3
|
|
8
4
|
banner "knife node lastrun NODE"
|
9
5
|
|
6
|
+
deps do
|
7
|
+
require 'highline'
|
8
|
+
end
|
9
|
+
|
10
10
|
def h
|
11
11
|
@highline ||= HighLine.new
|
12
12
|
end
|
@@ -48,7 +48,7 @@ module GoulahPlugins
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
ui.msg h.list(log_entries, :
|
51
|
+
ui.msg h.list(log_entries, :uneven_columns_across, 4)
|
52
52
|
ui.msg "\n"
|
53
53
|
|
54
54
|
# debug stuff
|
data/lib/lastrun_update.rb
CHANGED
@@ -3,26 +3,27 @@ require 'chef/log'
|
|
3
3
|
class LastRunUpdateHandler < Chef::Handler
|
4
4
|
|
5
5
|
def report
|
6
|
-
|
6
|
+
_node = Chef::Node.load(node.name)
|
7
|
+
_node.set[:lastrun] = {}
|
7
8
|
|
8
|
-
|
9
|
+
_node.set[:lastrun][:status] = run_status.success? ? "success" : "failed"
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
_node.set[:lastrun][:runtimes] = {}
|
12
|
+
_node.set[:lastrun][:runtimes][:elapsed] = run_status.elapsed_time
|
13
|
+
_node.set[:lastrun][:runtimes][:start] = run_status.start_time
|
14
|
+
_node.set[:lastrun][:runtimes][:end] = run_status.end_time
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
_node.set[:lastrun][:debug] = {}
|
17
|
+
_node.set[:lastrun][:debug][:backtrace] = run_status.backtrace
|
18
|
+
_node.set[:lastrun][:debug][:exception] = run_status.exception
|
19
|
+
_node.set[:lastrun][:debug][:formatted_exception] = run_status.formatted_exception
|
19
20
|
|
20
|
-
|
21
|
-
run_status.updated_resources.each do |resource|
|
21
|
+
_node.set[:lastrun][:updated_resources] = []
|
22
|
+
Array(run_status.updated_resources).each do |resource|
|
22
23
|
m = "recipe[#{resource.cookbook_name}::#{resource.recipe_name}] ran '#{resource.action}' on #{resource.resource_name} '#{resource.name}'"
|
23
24
|
Chef::Log.debug(m)
|
24
25
|
|
25
|
-
|
26
|
+
_node.set[:lastrun][:updated_resources].insert(0, {
|
26
27
|
:cookbook_name => resource.cookbook_name,
|
27
28
|
:recipe_name => resource.recipe_name,
|
28
29
|
:action => resource.action,
|
@@ -32,7 +33,11 @@ class LastRunUpdateHandler < Chef::Handler
|
|
32
33
|
|
33
34
|
end
|
34
35
|
|
35
|
-
# Save
|
36
|
-
|
36
|
+
# Save attributes to node unless overridden runlist has been supplied
|
37
|
+
if Chef::Config.override_runlist
|
38
|
+
Chef::Log.warn("Skipping final node save because override_runlist was given")
|
39
|
+
else
|
40
|
+
_node.save
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
metadata
CHANGED
@@ -1,70 +1,53 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-lastrun
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
version: 0.0.4
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- John Goulah
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
date: 2012-02-21 00:00:00 +00:00
|
18
|
-
default_executable:
|
12
|
+
date: 2015-08-04 00:00:00.000000000 Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
|
-
|
22
|
-
email:
|
14
|
+
description: A plugin for Chef::Knife which displays node metadata about the last
|
15
|
+
chef run.
|
16
|
+
email:
|
23
17
|
- jgoulah@gmail.com
|
24
18
|
executables: []
|
25
|
-
|
26
19
|
extensions: []
|
27
|
-
|
28
20
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
21
|
+
files:
|
31
22
|
- .gitignore
|
32
23
|
- README.md
|
33
24
|
- knife-lastrun.gemspec
|
34
25
|
- lib/chef/knife/lastrun.rb
|
35
26
|
- lib/knife-lastrun/version.rb
|
36
27
|
- lib/lastrun_update.rb
|
37
|
-
has_rdoc: true
|
38
28
|
homepage: https://github.com/jgoulah/knife-lastrun
|
39
29
|
licenses: []
|
40
|
-
|
41
30
|
post_install_message:
|
42
31
|
rdoc_options: []
|
43
|
-
|
44
|
-
require_paths:
|
32
|
+
require_paths:
|
45
33
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
35
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
|
52
|
-
|
53
|
-
version: "0"
|
54
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
41
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
- 0
|
61
|
-
version: "0"
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
62
46
|
requirements: []
|
63
|
-
|
64
47
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
48
|
+
rubygems_version: 1.8.23.2
|
66
49
|
signing_key:
|
67
50
|
specification_version: 3
|
68
|
-
summary: A plugin for Chef::Knife which displays node metadata about the last chef
|
51
|
+
summary: A plugin for Chef::Knife which displays node metadata about the last chef
|
52
|
+
run.
|
69
53
|
test_files: []
|
70
|
-
|