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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 94052e4bc31214ed3d933ea32e32eec0b4edb4fa
4
- data.tar.gz: 8961c6197922aabe3f37c1e6512f34f39ec3d5f9
3
+ metadata.gz: b2d0dc307ee907f00f7887f2ef46cb27aecefcf4
4
+ data.tar.gz: abb5652ac51d594b2f2749a599b6f5decba542b1
5
5
  SHA512:
6
- metadata.gz: ed3bca73a87926b22a535f3a90433d46f92e1431c3a8b75cee5ae6cefe615e93e63568aa2565e7b5ca0d1846566bcc41186448274f71a395c599a6ba2e72f853
7
- data.tar.gz: fb41fbd804d5b37d2db68f01865ff4ec3a9777e273c2541423db22d7f85aa94327fba3d8b40bb4d0c0ce63efbf48111dbd0ee12f2557f4b41d33a74c063a7224
6
+ metadata.gz: 111b7aeebdc6ba42a2b61df54a73f1bf8655a5b23dd5de777362e9d42ecb3b1f3fbcd8b5b3c03e6933d4f38ad92a8322f5ca405e50a4f1d2918120ffe6081645
7
+ data.tar.gz: f1fc9a102464d737fe314dd78f7f0e7e8482a7809d8f858ee6992548f1950f17121996b739168a170135c70497c867993b2a29a7490fd236f59587300b3412ec
@@ -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
- @old_chef_server_url = Chef::Config.chef_server_url
62
- @old_chef_repo_path = Chef::Config.chef_repo_path
63
- @old_node_name = Chef::Config.node_name
64
- @old_custom_http_headers = Chef::Config.custom_http_headers
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
- Chef::Config.chef_server_url = "#{Chef::Config.chef_server_url}/organizations/#{name}"
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
- Chef::Config.chef_server_url = @old_chef_server_url
87
- Chef::Config.chef_repo_path = @old_chef_repo_path
88
- Chef::Config.node_name = @old_node_name
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
@@ -1,3 +1,3 @@
1
1
  module KnifeECBackup
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-ec-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
4
+ version: 0.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser