knife-ec-backup 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/knife/ec_backup.rb +15 -11
- data/lib/knife_ec_backup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2d0dc307ee907f00f7887f2ef46cb27aecefcf4
|
4
|
+
data.tar.gz: abb5652ac51d594b2f2749a599b6f5decba542b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 111b7aeebdc6ba42a2b61df54a73f1bf8655a5b23dd5de777362e9d42ecb3b1f3fbcd8b5b3c03e6933d4f38ad92a8322f5ca405e50a4f1d2918120ffe6081645
|
7
|
+
data.tar.gz: f1fc9a102464d737fe314dd78f7f0e7e8482a7809d8f858ee6992548f1950f17121996b739168a170135c70497c867993b2a29a7490fd236f59587300b3412ec
|
data/lib/chef/knife/ec_backup.rb
CHANGED
@@ -57,16 +57,22 @@ class Chef
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
PATHS = %w(chef_repo_path cookbook_path environment_path data_bag_path role_path node_path client_path acl_path group_path container_path)
|
61
|
+
CONFIG_VARS = %w(chef_server_url custom_http_headers node_name client_key) + PATHS
|
60
62
|
def download_org(dest_dir, webui_key, name)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
@old_client_key = Chef::Config.client_key
|
63
|
+
old_config = {}
|
64
|
+
CONFIG_VARS.each do |key|
|
65
|
+
old_config[key] = Chef::Config[key]
|
66
|
+
end
|
66
67
|
begin
|
67
|
-
|
68
|
+
# Clear out paths
|
69
|
+
PATHS.each do |path_var|
|
70
|
+
Chef::Config[path_var] = nil
|
71
|
+
end
|
68
72
|
Chef::Config.chef_repo_path = "#{dest_dir}/organizations/#{name}"
|
69
73
|
|
74
|
+
Chef::Config.chef_server_url = "#{Chef::Config.chef_server_url}/organizations/#{name}"
|
75
|
+
|
70
76
|
# Figure out who the admin is so we can spoof him and retrieve his stuff
|
71
77
|
admin_users = rest.get_rest('groups/admins')['users']
|
72
78
|
org_members = rest.get_rest('users').map { |user| user['user']['username'] }
|
@@ -83,11 +89,9 @@ class Chef
|
|
83
89
|
@error = true
|
84
90
|
end
|
85
91
|
ensure
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
Chef::Config.custom_http_headers = @old_custom_http_headers
|
90
|
-
Chef::Config.client_key = @old_client_key
|
92
|
+
CONFIG_VARS.each do |key|
|
93
|
+
Chef::Config[key] = old_config[key]
|
94
|
+
end
|
91
95
|
end
|
92
96
|
end
|
93
97
|
end
|