knife-zero 1.16.0 → 1.17.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e940242f9ebe1c19473adc25bef46f8b89b1b359
4
- data.tar.gz: dde637d69d0166f2b9d319991cef01c5882c3f22
3
+ metadata.gz: a40dd1fc641fbf981484851683d3825740e2bcf5
4
+ data.tar.gz: 24f980020ff1fd340b3d8a0727d2d0b6ea2825f0
5
5
  SHA512:
6
- metadata.gz: 4aa9468e7d718dd2cb6f084e44f516d09c9d68da2e5ecf4d7541306025f04c572f325e54a219a1bdcb512b069a36a4a9a4c2bbba98c259317b03516177ed567c
7
- data.tar.gz: f3ae4989676b9e3af6f707fecef55f64ad22183c0e391922971d658237cb3b9e347ce99b305e8f000181fdb78bbdee8249511c0d07870de1640d59038e4595ea
6
+ metadata.gz: 3136f76b2f8c591eda4675fb6bf83c17ccf895b949ea99b41225f00cfb5de3cbb46bce42e799d45254f30e94d0eb582dd4a927b70f289e97524fb5d3262d2db7
7
+ data.tar.gz: c4dcc970035cde7144b592c49896758e8c28c1dd44cc018cc0b2dd79399377800966353d14925cff4cc2c1ab413f4db5556a70df78927c3508223dfa8cae07dd
data/CHANGELOG.md CHANGED
@@ -4,6 +4,15 @@
4
4
 
5
5
  Empty.
6
6
 
7
+ ## v1.17.1
8
+
9
+ - [Bugfix]: change of 1.17.0 crashes nodenameless bootstrapping.
10
+
11
+ ## v1.17.0(Yanked)
12
+
13
+ - Change: Ask overwrite node object at bootstrap #101
14
+ - New option `--[no-]overwrite`
15
+
7
16
  ## v1.16.0
8
17
 
9
18
  - [Feature] converge with `--json-attributes` #98
@@ -33,17 +33,24 @@ class Chef
33
33
  self.options = Bootstrap.options.merge(self.options)
34
34
 
35
35
  option :bootstrap_converge,
36
- :long => "--[no-]converge",
37
- :description => "Bootstrap without Chef-Client Run.(for only update client.rb)",
38
- :boolean => true,
39
- :default => true,
40
- :proc => lambda { |v| Chef::Config[:knife][:bootstrap_converge] = v }
36
+ :long => "--[no-]converge",
37
+ :description => "Bootstrap without Chef-Client Run.(for only update client.rb)",
38
+ :boolean => true,
39
+ :default => true,
40
+ :proc => lambda { |v| Chef::Config[:knife][:bootstrap_converge] = v }
41
+
42
+ option :overwrite_node_object,
43
+ :long => "--[no-]overwrite",
44
+ :description => "Overwrite local node object if node already exist. false by default",
45
+ :boolean => true,
46
+ :default => false,
47
+ :proc => lambda { |v| Chef::Config[:knife][:overwrite_node_object] = v }
41
48
 
42
49
  option :appendix_config,
43
- :long => "--appendix-config PATH",
44
- :description => "Append lines to end of client.rb on remote node from file.",
45
- :proc => lambda { |o| File.read(o) },
46
- :default => nil
50
+ :long => "--appendix-config PATH",
51
+ :description => "Append lines to end of client.rb on remote node from file.",
52
+ :proc => lambda { |o| File.read(o) },
53
+ :default => nil
47
54
 
48
55
  def run
49
56
  ## Command hook before_bootstrap (After launched Chef-Zero)
@@ -51,6 +58,23 @@ class Chef
51
58
  ::Knife::Zero::Helper.hook_shell_out!("before_bootstrap", ui, Chef::Config[:knife][:before_bootstrap])
52
59
  end
53
60
 
61
+ if @config[:bootstrap_converge]
62
+ unless @config[:overwrite_node_object]
63
+ q = Chef::Search::Query.new
64
+ node_name = resolve_node_name
65
+ result = q.search(:node, "name:#{node_name} OR knife_zero_host:#{node_name}")
66
+ if result.last > 0
67
+ ui.warn(%Q{Node "#{node_name}" already exist. [Found #{result.last} Node(s) in local search.] (You can skip asking with --overwrite option.)})
68
+ if result.last == 1
69
+ ui.confirm(%Q{Overwrite it }, true, false)
70
+ else
71
+ ui.confirm(%Q{Overwrite one of them }, true, false)
72
+ end
73
+ end
74
+ end
75
+ end
76
+
77
+
54
78
  if @config[:first_boot_attributes_from_file]
55
79
  @config[:first_boot_attributes_from_file] = @config[:first_boot_attributes_from_file].merge(build_knifezero_attributes_for_node)
56
80
  else
@@ -113,6 +137,10 @@ class Chef
113
137
  attr
114
138
  end
115
139
 
140
+ def resolve_node_name
141
+ return @config[:chef_node_name] if @config[:chef_node_name]
142
+ @cli_arguments.first.split('@').last
143
+ end
116
144
  end
117
145
  end
118
146
  end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.16.0"
3
+ VERSION = "1.17.1"
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.16.0
4
+ version: 1.17.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-06 00:00:00.000000000 Z
11
+ date: 2016-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler