last-seen-recipes-handler 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +30 -0
- data/last-seen-recipes-handler.gemspec +18 -0
- data/lib/last-seen-recipes-handler/version.rb +3 -0
- data/lib/last_seen_recipes.rb +14 -0
- metadata +59 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# last-seen-recipes-handler
|
2
|
+
|
3
|
+
A Chef handler that will add a new node attribute called "last\_seen\_recipes" which contains the list of all recipes run on the node _including_ the included recipes. This can then be used to search nodes for included recipes.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
#### Gem install
|
8
|
+
|
9
|
+
last-seen-recipe-handler is available on rubygems.org - if you have that source in your gemrc, you can simply use:
|
10
|
+
|
11
|
+
gem install last-seen-recipe-handler
|
12
|
+
|
13
|
+
#### Configure the Handler
|
14
|
+
|
15
|
+
in /etc/chef/client.rb
|
16
|
+
|
17
|
+
```
|
18
|
+
# seen recipes handler
|
19
|
+
require "last_seen_recipes"
|
20
|
+
last_seen_recipes_handler = LastSeenRecipesHandler.new
|
21
|
+
report_handlers << last_seen_recipes_handler
|
22
|
+
```
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Now simply use knife search to find your included recipe
|
27
|
+
|
28
|
+
```
|
29
|
+
knife search node 'last_seen_recipes:mycookbook\:\:myrecipe' -i
|
30
|
+
```
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "last-seen-recipes-handler/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = 'last-seen-recipes-handler'
|
7
|
+
s.version = LastSeenRecipesHandler::VERSION
|
8
|
+
s.date = '2012-06-26'
|
9
|
+
s.summary = "A plugin for Chef::Knife which displays node metadata about the last chef run."
|
10
|
+
s.description = s.summary
|
11
|
+
s.authors = ["John Goulah"]
|
12
|
+
s.email = ["jgoulah@gmail.com"]
|
13
|
+
s.homepage = "https://github.com/jgoulah/last-seen-recipes-handler"
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
class LastSeenRecipesHandler < Chef::Handler
|
3
|
+
def report
|
4
|
+
last_seen_recipes = node.run_state[:seen_recipes].keys
|
5
|
+
Chef::Log.debug("seen recipes handler recipe dump");
|
6
|
+
Chef::Log.debug(last_seen_recipes)
|
7
|
+
|
8
|
+
node.set[:last_seen_recipes] = []
|
9
|
+
unless last_seen_recipes.empty?
|
10
|
+
node.set[:last_seen_recipes] = last_seen_recipes
|
11
|
+
end
|
12
|
+
node.save
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: last-seen-recipes-handler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.0.2
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- John Goulah
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2012-06-26 00:00:00 Z
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: A plugin for Chef::Knife which displays node metadata about the last chef run.
|
17
|
+
email:
|
18
|
+
- jgoulah@gmail.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files: []
|
24
|
+
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- README.md
|
28
|
+
- last-seen-recipes-handler.gemspec
|
29
|
+
- lib/last-seen-recipes-handler/version.rb
|
30
|
+
- lib/last_seen_recipes.rb
|
31
|
+
homepage: https://github.com/jgoulah/last-seen-recipes-handler
|
32
|
+
licenses: []
|
33
|
+
|
34
|
+
post_install_message:
|
35
|
+
rdoc_options: []
|
36
|
+
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: "0"
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
none: false
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: "0"
|
51
|
+
requirements: []
|
52
|
+
|
53
|
+
rubyforge_project:
|
54
|
+
rubygems_version: 1.8.24
|
55
|
+
signing_key:
|
56
|
+
specification_version: 3
|
57
|
+
summary: A plugin for Chef::Knife which displays node metadata about the last chef run.
|
58
|
+
test_files: []
|
59
|
+
|