chef-solo-enc 0.1.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.
data/README ADDED
@@ -0,0 +1,48 @@
1
+ = chef-solo-enc
2
+
3
+ == Description
4
+
5
+ External Node Classifiers for chef-solo.
6
+
7
+ see http://docs.puppetlabs.com/guides/external_nodes.html
8
+
9
+
10
+ (!!notice!! chef-solo-enc overwrite chef-solo command)
11
+
12
+ == Source Code
13
+
14
+ https://bitbucket.org/winebarrel/chef-solo-enc
15
+
16
+ == Install
17
+
18
+ gem install chef-solo-enc
19
+
20
+ == Example
21
+
22
+ === External Node Classifiers
23
+
24
+ $chef-repo/nodes/external_nodes
25
+
26
+ #!/bin/bash
27
+ echo '{"run_list":"recipe[any_recipe]"}'
28
+
29
+ shell> knife solo cook any_server -V
30
+ Starting 'Run'
31
+ Checking Chef version...
32
+ ...
33
+ [2013-07-15T15:11:21+00:00] INFO: External Node Classifiers Result is {"run_list"=>"recipe[any_recipet]"}
34
+ Starting Chef Client, version 11.4.4
35
+ [2013-07-15T15:11:21+00:00] INFO: *** Chef 11.4.4 ***
36
+ ...
37
+ [2013-07-15T15:11:22+00:00] INFO: Run List is [recipe[any_recipet]]
38
+ ...
39
+
40
+ == License
41
+
42
+ This software is under "'I like puppet' License".
43
+
44
+ * Please remember Puppet once per year.
45
+ * Please do not pitied people who use Puppet.
46
+ * Please use Puppet when you feel like it.
47
+
48
+ (It's a joke.)
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'rubygems'
4
+ $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
5
+ require 'chef/application/solo'
6
+
7
+ # fix Chef::Clien
8
+ require 'chef/application/client'
9
+
10
+ class Chef
11
+ class Client
12
+ alias run_method_alias_for_chef_solo_enc run
13
+
14
+ def run(*args)
15
+ external_nodes_path_list = [
16
+ ENV['EXTERNAL_NODE_CLASSIFIERS'],
17
+ File.join(Chef::Config[:node_path], 'external_nodes'),
18
+ File.join(Chef::Config[:file_cache_path], 'nodes', 'external_nodes'),
19
+ ]
20
+
21
+ external_nodes_path = external_nodes_path_list.find {|i| i and File.exist?(i) }
22
+
23
+ if external_nodes_path
24
+ @json_attribs ||= {'run_list'=>[]}
25
+
26
+ begin
27
+ system("chmod 700 #{external_nodes_path}")
28
+ json = JSON.parse(`#{external_nodes_path}`)
29
+ Chef::Log.info("External Node Classifiers Result is #{json.inspect}")
30
+ @json_attribs.update(json)
31
+ rescue => e
32
+ Chef::Log.warn("Execution of External Node Classifiers fained: #{e.message}")
33
+ end
34
+ end
35
+
36
+ run_method_alias_for_chef_solo_enc(*args)
37
+ end
38
+ end
39
+ end
40
+
41
+ Chef::Application::Solo.new.run
@@ -0,0 +1,3 @@
1
+ module ChefSoloENC
2
+ VERSION = '0.1.0'
3
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: chef-solo-enc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - winebarrel
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-07-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: chef
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 11.4.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 11.4.4
30
+ description:
31
+ email: sgwr_dts@yahoo.co.jp
32
+ executables:
33
+ - chef-solo
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - README
38
+ - bin/chef-solo
39
+ - lib/chef-solo-enc/constants.rb
40
+ homepage: https://bitbucket.org/winebarrel/chef-solo-enc
41
+ licenses:
42
+ - MIT
43
+ post_install_message:
44
+ rdoc_options: []
45
+ require_paths:
46
+ - lib
47
+ required_ruby_version: !ruby/object:Gem::Requirement
48
+ none: false
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 1.8.23
62
+ signing_key:
63
+ specification_version: 3
64
+ summary: External Node Classifiers for chef-solo.
65
+ test_files: []