knife-spork 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/knife-spork.gemspec +1 -1
- data/lib/chef/knife/spork-promote.rb +22 -3
- data/lib/knife-spork.rb +1 -1
- metadata +2 -2
data/knife-spork.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
## If your rubyforge_project name is different, then edit it and comment out
|
14
14
|
## the sub! line in the Rakefile
|
15
15
|
s.name = 'knife-spork'
|
16
|
-
s.version = '0.1.
|
16
|
+
s.version = '0.1.8'
|
17
17
|
s.date = '2012-02-21'
|
18
18
|
s.rubyforge_project = 'knife-spork'
|
19
19
|
|
@@ -117,11 +117,12 @@ module KnifeSpork
|
|
117
117
|
@cookbook = @name_args[0]
|
118
118
|
end
|
119
119
|
|
120
|
+
check_cookbook_uploaded(@cookbook)
|
121
|
+
|
120
122
|
environments.each do |e|
|
121
123
|
ui.msg ""
|
122
124
|
ui.msg "Environment: #{e}"
|
123
125
|
|
124
|
-
|
125
126
|
cookbook_path = config[:cookbook_path]
|
126
127
|
if cookbook_path.size > 1
|
127
128
|
@environment = loader.load_from("environments", "#{e}.json")
|
@@ -129,7 +130,7 @@ module KnifeSpork
|
|
129
130
|
path = cookbook_path[0].gsub("cookbooks","environments") + "/#{e}.json"
|
130
131
|
@environment = loader.object_from_file("#{path}")
|
131
132
|
end
|
132
|
-
|
133
|
+
|
133
134
|
if @cookbook == "all"
|
134
135
|
ui.msg "Promoting ALL cookbooks to environment #{@environment}"
|
135
136
|
cookbook_names = get_all_cookbooks
|
@@ -293,7 +294,7 @@ module KnifeSpork
|
|
293
294
|
else
|
294
295
|
@version = get_version(config[:cookbook_path], cookbook)
|
295
296
|
end
|
296
|
-
|
297
|
+
|
297
298
|
ui.msg "Adding version constraint #{cookbook} = #{@version}"
|
298
299
|
return update_version_constraints(environment,cookbook,@version)
|
299
300
|
end
|
@@ -306,6 +307,24 @@ module KnifeSpork
|
|
306
307
|
end
|
307
308
|
return results
|
308
309
|
end
|
310
|
+
|
311
|
+
def check_cookbook_uploaded(cookbook)
|
312
|
+
if config[:version]
|
313
|
+
if !valid_version(config[:version])
|
314
|
+
ui.error("#{config[:version]} isn't a valid version number.")
|
315
|
+
return 1
|
316
|
+
else
|
317
|
+
@version = config[:version]
|
318
|
+
end
|
319
|
+
else
|
320
|
+
@version = get_version(config[:cookbook_path], cookbook)
|
321
|
+
end
|
322
|
+
ui.msg "Checking that #{cookbook} version #{@version} exists on the server before promoting (any error means it hasn't been uploaded yet)...\n\n"
|
323
|
+
env = config[:environment]
|
324
|
+
api_endpoint = env ? "environments/#{env}/cookbooks/#{cookbook}/#{@version}" : "cookbooks/#{cookbook}/#{@version}"
|
325
|
+
cookbooks = rest.get_rest(api_endpoint)
|
326
|
+
ui.msg "#{cookbook} version #{@version } found on server!"
|
327
|
+
end
|
309
328
|
|
310
329
|
def pretty_print(environment)
|
311
330
|
return JSON.pretty_generate(JSON.parse(environment.to_json))
|
data/lib/knife-spork.rb
CHANGED