chef-fork 0.1.4 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 27ab8b8ac21df3a0d5b098212c5ffbeb9e04d451
4
- data.tar.gz: 36b026de407cc595256b0e3e6c48479ed8eaa1fd
3
+ metadata.gz: fe0eeb08f02296252609611b83e26234f5e7f138
4
+ data.tar.gz: d6031a3748bc8f28e83286d918a960f0578d6f9b
5
5
  SHA512:
6
- metadata.gz: ded002d6b1c0f3f4765b3f2ef53a8841abf2cbfad90f2b44dc11844a3303fa33eec65a5add1202e56394e89af8b53b66ffc746dfb5ede4ce671fbbc2e0e10f3e
7
- data.tar.gz: 3ed37a840b18dec190520d9c095aeb8bd55b46cbda682cac6990057e2ae4ad55d32e2c06a0659091347377b0e31e4dc4916083ba470681e7839d380077f804b4
6
+ metadata.gz: 9f76363e0b5a9d7d674418d42de7d1af0c0b60b3b807cc5693779e78ccaa57676dd723a23ad68dc5e2673db17bcfbfbee7b690be94296c59717612a9242768cc
7
+ data.tar.gz: 46609e2da25c04ae096a2adc73c26767e26176a612be4c9fa88df96bdb24bc6e1684bb9fe5be3aaa1ed36cd9a42be229cc720ae8ed955bb5920ddecfe2366742
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- coding: utf-8 -*-
3
+
4
+ require "chef/knife/core/bootstrap_context"
5
+
6
+ class Chef
7
+ class Fork
8
+ module Bootstrap
9
+ class Context < ::Chef::Knife::Core::BootstrapContext
10
+ end
11
+ end
12
+ end
13
+ end
@@ -3,10 +3,11 @@
3
3
 
4
4
  require "chef"
5
5
  require "chef/config"
6
- require "chef/knife/core/bootstrap_context"
6
+ require "chef/encrypted_data_bag_item"
7
7
  require "erubis"
8
8
  require "json"
9
9
  require "shellwords"
10
+ require "chef/fork/bootstrap/context"
10
11
  require "chef/fork/commands/ssh"
11
12
 
12
13
  class Chef
@@ -94,6 +95,8 @@ class Chef
94
95
  def find_template(name)
95
96
  templates = $LOAD_PATH.map { |path|
96
97
  [
98
+ File.join(path, "chef", "fork", "bootstrap", "templates", "#{name}.erb"), # Chef 12.x
99
+ File.join(path, "chef", "fork", "bootstrap", "#{name}.erb"), # Chef 11.x
97
100
  File.join(path, "chef", "knife", "bootstrap", "templates", "#{name}.erb"), # Chef 12.x
98
101
  File.join(path, "chef", "knife", "bootstrap", "#{name}.erb"), # Chef 11.x
99
102
  ]
@@ -102,7 +105,23 @@ class Chef
102
105
  end
103
106
 
104
107
  def render_template(template)
105
- context = Chef::Knife::Core::BootstrapContext.new(options, options[:run_list], Chef::Config)
108
+ case Chef::VERSION.split(".").first
109
+ when "11"
110
+ context = Chef::Fork::Bootstrap::Context.new(options, options[:run_list], Chef::Config)
111
+ else
112
+ if Chef::Config[:knife][:secret]
113
+ secret = Chef::Config[:knife][:secret]
114
+ else
115
+ if Chef::Config[:knife][:secret_file]
116
+ secret = Chef::EncryptedDataBagItem.load_secret(Chef::Config[:knife][:secret_file])
117
+ end
118
+ end
119
+ if secret
120
+ context = Chef::Fork::Bootstrap::Context.new(options, options[:run_list], Chef::Config, secret)
121
+ else
122
+ context = Chef::Fork::Bootstrap::Context.new(options, options[:run_list], Chef::Config)
123
+ end
124
+ end
106
125
  Erubis::Eruby.new(template).evaluate(context)
107
126
  end
108
127
  end
@@ -1,5 +1,5 @@
1
1
  class Chef
2
2
  class Fork
3
- VERSION = "0.1.4"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-fork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yamashita Yuu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-22 00:00:00.000000000 Z
11
+ date: 2016-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -85,6 +85,7 @@ files:
85
85
  - knife-and-fork.md
86
86
  - lib/chef/fork.rb
87
87
  - lib/chef/fork/application.rb
88
+ - lib/chef/fork/bootstrap/context.rb
88
89
  - lib/chef/fork/commands.rb
89
90
  - lib/chef/fork/commands/bootstrap.rb
90
91
  - lib/chef/fork/commands/cookbook.rb
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
117
  version: '0'
117
118
  requirements: []
118
119
  rubyforge_project:
119
- rubygems_version: 2.2.3
120
+ rubygems_version: 2.5.1
120
121
  signing_key:
121
122
  specification_version: 4
122
123
  summary: A tool for your left hand, to have a meal cooked by chef.