knife-zero 1.12.1 → 1.13.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: 1c14d86c9f5ba40c4758f6bc7553e0e3f299533f
4
- data.tar.gz: 049fcba1509a56553e1547c0d2dc98d8854db324
3
+ metadata.gz: 03d111ff54381aa4b04054cb4361f8f8e7e5d015
4
+ data.tar.gz: a3bbc9916becca098ac252ebf8829cfd2ebd3020
5
5
  SHA512:
6
- metadata.gz: e9cd094110b0219b0ed1ba74d854f44e5f6a624d195d202cfa4cdc3f980cde6004ba9d4978384c2f382f835993dcc4d20bbd7644200d3dc1aeb69b41ad55b609
7
- data.tar.gz: d24fcd3e46f799d4098bb69407b57119bd3b1c4b1c268d868fb384ff93b0cce9710842c4f1682ec50cbee35f6458cc06fd9656bd2014f0d0ff0d1ebb0b6c2381
6
+ metadata.gz: abcb2c7552806897a0bf5281c656adc38717eb11c48d912c5a64c5e664e6770e51aa00e7b5826acc169757f8ebdc390263d95603a6aa85cfb6948b114112d2fb
7
+ data.tar.gz: 3e9d4dc4a096967a205edbf02a2789137cf79748466e23ad8703e8767a243b3c0073854f87e62beb947111b677a5ff49cf27c53d63b9a473888d22e17ddf5c39
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v1.13.0
6
+
7
+ - Feature: Support single Policyfile #80
8
+ - Feature: Add new option --appendix-config to zero bootstrap #82
5
9
 
6
10
  ## v1.12.1
7
11
 
data/README.md CHANGED
@@ -19,6 +19,8 @@ Run chef-client at remote node with chef-zero(local-mode) via HTTP over SSH port
19
19
  - [Knife-Zero Document](https://knife-zero.github.io)
20
20
  - [Knife-Zero Document(Ja)](https://knife-zero.github.io/ja/)
21
21
 
22
+ - [CHANGELOG](https://github.com/higanworks/knife-zero/blob/master/CHANGELOG.md)
23
+
22
24
  ## Requirements
23
25
 
24
26
  - Must support AllowTcpForward
@@ -18,6 +18,7 @@ class Chef
18
18
  self.options = Bootstrap.options.merge(self.options)
19
19
  self.options.delete :node_ssl_verify_mode
20
20
  self.options.delete :node_verify_api_cert
21
+ self.options.delete :policy_group
21
22
 
22
23
  ## Override to use nil by default. It should be create PR
23
24
  option :ssh_user,
@@ -31,6 +32,15 @@ class Chef
31
32
  :default => true,
32
33
  :proc => lambda { |v| Chef::Config[:knife][:bootstrap_converge] = v }
33
34
 
35
+ option :appendix_config,
36
+ :long => "--appendix-config PATH",
37
+ :description => "Append lines to end of client.rb on remote node from file.",
38
+ :proc => lambda { |o| File.read(o) },
39
+ :default => nil
40
+
41
+ ## For support policy_document_databag(old style)
42
+ self.options[:policy_name][:description] = "Policy name to use (It'll be set as deployment_group=POLICY_NAME-local)"
43
+
34
44
  def run
35
45
  ## Command hook before_bootstrap (After launched Chef-Zero)
36
46
  if Chef::Config[:knife][:before_bootstrap]
@@ -72,6 +82,15 @@ class Chef
72
82
  end
73
83
  end
74
84
 
85
+ ## For support policy_document_databag(old style)
86
+ def validate_options!
87
+ if policyfile_and_run_list_given?
88
+ ui.error("Policyfile options and --run-list are exclusive")
89
+ exit 1
90
+ end
91
+ true
92
+ end
93
+
75
94
  def build_knifezero_attributes_for_node
76
95
  ## Return to Pending.
77
96
  # ssh_url = String.new("ssh://")
@@ -34,6 +34,12 @@ class Chef
34
34
  :default => nil,
35
35
  :proc => lambda { |o| o.to_s }
36
36
 
37
+ ## For support policy_document_databag(old style)
38
+ option :named_run_list,
39
+ :short => "-n NAMED_RUN_LIST",
40
+ :long => "--named-run-list NAMED_RUN_LIST",
41
+ :description => "Use a policyfile's named run list instead of the default run list"
42
+
37
43
  option :client_version,
38
44
  :long => "--client-version [latest|VERSION]",
39
45
  :description => "Up or downgrade omnibus chef-client before converge.",
@@ -56,6 +62,8 @@ class Chef
56
62
  ::Knife::Zero::Helper.hook_shell_out!("before_converge", ui, Chef::Config[:knife][:before_converge])
57
63
  end
58
64
 
65
+ validate_options!
66
+
59
67
  @name_args = [@name_args[0], start_chef_client]
60
68
  end
61
69
 
@@ -70,6 +78,28 @@ class Chef
70
78
  Chef::Log.info "Remote command: " + s
71
79
  s
72
80
  end
81
+
82
+ ## For support policy_document_databag(old style)
83
+ def validate_options!
84
+ if override_and_named_given?
85
+ ui.error("--override_runlist and --named_run_list are exclusive")
86
+ exit 1
87
+ end
88
+ true
89
+ end
90
+ # True if policy_name and run_list are both given
91
+ def override_and_named_given?
92
+ override_runlist_given? && named_run_list_given?
93
+ end
94
+
95
+ def override_runlist_given?
96
+ !config[:run_list].nil? && !config[:run_list].empty?
97
+ end
98
+
99
+ def named_run_list_given?
100
+ !config[:run_list].nil? && !config[:run_list].empty?
101
+ end
102
+
73
103
  end
74
104
  end
75
105
  end
@@ -28,6 +28,20 @@ class Chef
28
28
  end
29
29
  end
30
30
  client_rb << white_lists.join("\n")
31
+
32
+ ## For support policy_document_databag(old style)
33
+ if @config[:policy_name]
34
+ client_rb << ["\n", "use_policyfile true",
35
+ "versioned_cookbooks true",
36
+ "policy_document_native_api false",
37
+ %Q{deployment_group "#{@config[:policy_name]}-local"}].join("\n")
38
+ end
39
+
40
+ if @config[:appendix_config]
41
+ client_rb << ["\n## --appendix-config", @config[:appendix_config]].join("\n")
42
+ end
43
+
44
+ client_rb
31
45
  end
32
46
 
33
47
  alias :orig_start_chef start_chef
@@ -49,6 +63,16 @@ class Chef
49
63
  orig_start_chef
50
64
  end
51
65
  end
66
+
67
+ ## For support policy_document_databag(old style)
68
+ alias :orig_first_boot first_boot
69
+ def first_boot
70
+ attributes = orig_first_boot
71
+ if @config[:policy_name]
72
+ attributes.delete(:run_list)
73
+ end
74
+ attributes
75
+ end
52
76
  end
53
77
  end
54
78
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.12.1"
3
+ VERSION = "1.13.0"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.1
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-10 00:00:00.000000000 Z
11
+ date: 2016-01-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler