knife-env-diff 0.0.2 → 0.0.3
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.
- data/lib/chef/knife/env-diff.rb +8 -17
- data/lib/knife-env-diff/version.rb +1 -1
- metadata +2 -2
data/lib/chef/knife/env-diff.rb
CHANGED
@@ -32,24 +32,24 @@ module GoulahKnifePlugins
|
|
32
32
|
otherenvs = name_args.slice(1, name_args.length - 1)
|
33
33
|
|
34
34
|
from_env = {}
|
35
|
-
|
36
|
-
from_env[firstenv] = env.cookbook_versions
|
35
|
+
from_env[firstenv] = get_env_cookbooks(firstenv)
|
37
36
|
|
38
37
|
to_env = {}
|
39
38
|
otherenvs.each do |env_name|
|
40
|
-
|
41
|
-
to_env[env_name] = env.cookbook_versions
|
39
|
+
to_env[env_name] = get_env_cookbooks(env_name)
|
42
40
|
end
|
43
41
|
|
44
42
|
ui.msg "diffing environment " + firstenv + " against " + otherenvs.join(', ') + "\n\n"
|
45
43
|
|
46
44
|
from_env.each_value do |from_cookbooks|
|
47
|
-
from_cookbooks.each do |from_cookbook,
|
45
|
+
from_cookbooks.each do |from_cookbook, from_data|
|
46
|
+
from_version = from_data["versions"].first['version']
|
48
47
|
|
49
48
|
diff_versions = {}
|
50
49
|
|
51
50
|
to_env.each do |to_env, to_cookbooks|
|
52
|
-
to_version = to_cookbooks[from_cookbook]
|
51
|
+
to_version = to_cookbooks[from_cookbook]["versions"].first['version']
|
52
|
+
|
53
53
|
if from_version != to_version
|
54
54
|
diff_versions[to_env] = to_version
|
55
55
|
end
|
@@ -69,17 +69,8 @@ module GoulahKnifePlugins
|
|
69
69
|
|
70
70
|
end
|
71
71
|
|
72
|
-
|
73
|
-
|
74
|
-
return e
|
75
|
-
rescue Net::HTTPServerException => e
|
76
|
-
if e.response.code.to_s == "404"
|
77
|
-
ui.error "The environment #{env} does not exist on the server, aborting."
|
78
|
-
Chef::Log.debug(e)
|
79
|
-
exit 1
|
80
|
-
else
|
81
|
-
raise
|
82
|
-
end
|
72
|
+
def get_env_cookbooks(env)
|
73
|
+
rest.get_rest("environments/#{env}/cookbooks")
|
83
74
|
end
|
84
75
|
|
85
76
|
end
|