chef_cap 0.3.19 → 0.3.20

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module ChefCap
2
- VERSION = "0.3.19"
2
+ VERSION = "0.3.20"
3
3
  end
data/recipes/chef_cap.rb CHANGED
@@ -90,11 +90,17 @@ namespace :ssh do
90
90
 
91
91
  desc "Set any defined SSH options"
92
92
  task :set_options do
93
- ssh_options[:paranoid] = ssh_options_paranoid rescue nil
94
- ssh_options[:keys] = ssh_options_keys rescue nil
95
- ssh_options[:forward_agent] = ssh_options_forward_agent rescue nil
96
- ssh_options[:username] = ssh_options_username rescue user rescue nil
97
- ssh_options[:port] = ssh_options_port rescue nil
93
+ options = {}
94
+ options[:config] = ssh_options_config rescue nil
95
+ options[:paranoid] = ssh_options_paranoid rescue nil
96
+ options[:keys] = ssh_options_keys rescue nil
97
+ options[:forward_agent] = ssh_options_forward_agent rescue nil
98
+ options[:username] = ssh_options_username rescue user rescue nil
99
+ options[:port] = ssh_options_port rescue nil
100
+ options.reject! { |key| options[key].nil? }
101
+ options.each_pair do |key, value|
102
+ ssh_options[key] = value
103
+ end
98
104
  end
99
105
  end
100
106
  before "chef:setup", "ssh:transfer_keys"
@@ -169,18 +175,12 @@ namespace :chef do
169
175
  install_chef_cmd = "gem install chef --no-ri --no-rdoc --version=#{chef_version}"
170
176
  run "#{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
171
177
 
172
- gem_check_for_bundler_cmd = "gem specification --version '>0' bundler 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
173
- install_bundler_cmd = "gem install bundler --no-ri --no-rdoc"
174
- run "#{gem_check_for_bundler_cmd} || #{install_bundler_cmd} && echo 'Bundler already on this server.'"
175
178
  run "rbenv rehash"
176
179
  else
177
180
  gem_check_for_chef_cmd = "gem specification --version '>=#{chef_version}' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
178
181
  install_chef_cmd = "sudo `cat #{rvm_bin_path}` default exec gem install chef --no-ri --no-rdoc --version=#{chef_version}"
179
182
  sudo "`cat #{rvm_bin_path}` default exec #{gem_check_for_chef_cmd} || #{install_chef_cmd} && echo 'Chef Solo already on this server.'"
180
183
 
181
- gem_check_for_bundler_cmd = "gem specification --version '>0' bundler 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }'"
182
- install_bundler_cmd = "sudo `cat #{rvm_bin_path}` default exec gem install bundler --no-ri --no-rdoc"
183
- sudo "`cat #{rvm_bin_path}` default exec #{gem_check_for_bundler_cmd} || #{install_bundler_cmd} && echo 'Bundler already on this server.'"
184
184
  sudo "`cat #{rvm_bin_path}` default exec which chef-solo"
185
185
  end
186
186
  end
@@ -93,7 +93,7 @@ end
93
93
  def unset(key)
94
94
  @variables.delete(key)
95
95
  self.instance_eval(<<-EOS)
96
- undef #{key}
96
+ undef #{key} rescue nil
97
97
  EOS
98
98
  end
99
99
 
@@ -229,7 +229,8 @@ describe "chef_cap" do
229
229
  "authorized_pub_file": "#{File.join(File.dirname(__FILE__), '..', 'fixtures', 'ssh_public_key')}",
230
230
  "known_hosts": "knownhostscontent",
231
231
  "options": {
232
- "keys": "some_ssh_key_path"
232
+ "keys": "some_ssh_key_path",
233
+ "username": null
233
234
  }
234
235
  }
235
236
  },
@@ -312,6 +313,12 @@ describe "chef_cap" do
312
313
  chef_cap.cap_after[:nossh].should_not be_nil
313
314
  chef_cap.cap_after[:nossh].should include("ssh:set_options")
314
315
  end
316
+
317
+ it "does not set nil values" do
318
+ chef_cap.cap_task["ssh:set_options"].call
319
+ chef_cap.cap_ssh_options.has_key?(:username).should be_false
320
+ chef_cap.cap_ssh_options.has_key?(:config).should be_false
321
+ end
315
322
  end
316
323
 
317
324
  context "when a value is null" do
@@ -510,7 +517,6 @@ describe "chef_cap" do
510
517
  it "sets up chef gem" do
511
518
  chef_cap.cap_servers.should_not be_empty
512
519
  chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec gem specification --version '>=0.1982.1234' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || sudo `cat /tmp/.chef_cap_rvm_path` default exec gem install chef --no-ri --no-rdoc --version=0.1982.1234 && echo 'Chef Solo already on this server.'").and_return("mocked")
513
- chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec gem specification --version '>0' bundler 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || sudo `cat /tmp/.chef_cap_rvm_path` default exec gem install bundler --no-ri --no-rdoc && echo 'Bundler already on this server.'").and_return("mocked")
514
520
  chef_cap.should_receive(:sudo).ordered.with("`cat /tmp/.chef_cap_rvm_path` default exec which chef-solo").and_return("mocked")
515
521
 
516
522
  chef_cap.cap_task["bootstrap:ruby"].call
@@ -562,7 +568,6 @@ describe "chef_cap" do
562
568
  chef_cap.cap_servers.should_not be_empty
563
569
  chef_cap.stub!(:put => "stubbed")
564
570
  chef_cap.should_receive(:run).ordered.with("gem specification --version '>=0.1982.1234' chef 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || gem install chef --no-ri --no-rdoc --version=0.1982.1234 && echo 'Chef Solo already on this server.'").and_return("mocked")
565
- chef_cap.should_receive(:run).ordered.with("gem specification --version '>0' bundler 2>&1 | awk 'BEGIN { s = 0 } /^name:/ { s = 1; exit }; END { if(s == 0) exit 1 }' || gem install bundler --no-ri --no-rdoc && echo 'Bundler already on this server.'").and_return("mocked")
566
571
  chef_cap.should_receive(:run).ordered.with("rbenv rehash").and_return("mocked")
567
572
 
568
573
  chef_cap.cap_task["bootstrap:ruby"].call
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef_cap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.19
4
+ version: 0.3.20
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-26 00:00:00.000000000 Z
12
+ date: 2012-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano
16
- requirement: &70281951400000 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 2.5.5
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70281951400000
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.5.5
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rspec-rails
27
- requirement: &70281951399500 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,7 +37,12 @@ dependencies:
32
37
  version: '2.1'
33
38
  type: :development
34
39
  prerelease: false
35
- version_requirements: *70281951399500
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '2.1'
36
46
  description: chef_cap uses chef"s JSON config format to drive both capistrano and
37
47
  chef-solo"
38
48
  email:
@@ -93,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
93
103
  version: '0'
94
104
  segments:
95
105
  - 0
96
- hash: -1298707690600730626
106
+ hash: 1458186422045176253
97
107
  required_rubygems_version: !ruby/object:Gem::Requirement
98
108
  none: false
99
109
  requirements:
@@ -102,10 +112,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
112
  version: '0'
103
113
  segments:
104
114
  - 0
105
- hash: -1298707690600730626
115
+ hash: 1458186422045176253
106
116
  requirements: []
107
117
  rubyforge_project:
108
- rubygems_version: 1.8.17
118
+ rubygems_version: 1.8.19
109
119
  signing_key:
110
120
  specification_version: 3
111
121
  summary: capistrano + chef-solo == chef_cap"