yyuu-capistrano-chef-solo 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module ChefSolo
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -21,14 +21,24 @@ module Capistrano
21
21
 
22
22
  desc("Run chef-solo.")
23
23
  task(:default) {
24
- # login as chef user if specified
25
- set(:user, fetch(:chef_solo_user, user))
26
- set(:ssh_options, fetch(:chef_solo_ssh_options, ssh_options))
24
+ # preserve original :user and :ssh_options
25
+ set(:chef_solo_original_user, user)
26
+ set(:chef_solo_original_ssh_options, ssh_options)
27
27
 
28
- transaction {
29
- bootstrap
30
- update
31
- }
28
+ begin
29
+ # login as chef user if specified
30
+ set(:user, fetch(:chef_solo_user, user))
31
+ set(:ssh_options, fetch(:chef_solo_ssh_options, ssh_options))
32
+
33
+ transaction {
34
+ bootstrap
35
+ update
36
+ }
37
+ ensure
38
+ # restore original :user and :ssh_options
39
+ set(:user, chef_solo_original_user)
40
+ set(:ssh_options, chef_solo_original_ssh_options)
41
+ end
32
42
  }
33
43
 
34
44
  task(:bootstrap) {
@@ -101,16 +111,15 @@ module Capistrano
101
111
  # special variable to set multiple cookbooks repositories.
102
112
  # by default, it will build from :chef_solo_cookbooks_* variables.
103
113
  _cset(:chef_solo_cookbooks) {
104
- repository = fetch(:chef_solo_cookbooks_repository, fetch(:chef_solo_cookbook_repository, nil))
114
+ repository = fetch(:chef_solo_cookbooks_repository, nil)
115
+ repository = fetch(:chef_solo_cookbook_repository, nil) unless repository # for backward compatibility
105
116
  name = File.basename(repository, File.extname(repository))
106
- {
107
- name => {
108
- :repository => repository,
109
- :revision => fetch(:chef_solo_cookbooks_revision, fetch(:chef_solo_cookbook_revision, nil)),
110
- :cookbooks => fetch(:chef_solo_cookbooks_subdir, fetch(:chef_solo_cookbook_subdir, nil)),
111
- :cookbooks_exclude => chef_solo_cookbooks_exclude,
112
- }
113
- }
117
+ options = { :repository => repository, :cookbooks_exclude => chef_solo_cookbooks_exclude }
118
+ options[:revision] = fetch(:chef_solo_cookbooks_revision, nil)
119
+ options[:revision] = fetch(:chef_solo_cookbook_revision, nil) unless options[:revision] # for backward compatibility
120
+ options[:cookbooks] = fetch(:chef_solo_cookbooks_subdir, nil)
121
+ options[:cookbooks] = fetch(:chef_solo_cookbook_subdir, nil) unless options[:cookbooks] # for backward compatibility
122
+ { name => options }
114
123
  }
115
124
 
116
125
  _cset(:chef_solo_repository_cache) { File.expand_path('./tmp/cookbooks-cache') }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yyuu-capistrano-chef-solo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-06 00:00:00.000000000 Z
12
+ date: 2012-12-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano