knife-ec-backup 1.1.6 → 1.1.7
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_restore.rb +40 -5
- data/lib/knife_ec_backup/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d12c87f2f93b3140357b7206d01274571f8adb
|
4
|
+
data.tar.gz: b597018c25f2c2c8da15bbcee036e423c42a26db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be56f4584a4e166ead2daa956dbfd2659d572433a33520aba295aa26677acc5c22301b57898c3eb545b26bf7a722a673b3e3b245a7da5222ecfa5704c3e9cf45
|
7
|
+
data.tar.gz: 7c272d46ba92aa91d269dcde62adb146a1a1d4a8ec79ec45ca31acf20e6aa811e835a6103af85fbc1488973d6cf0447425f88b929488c27d68f4f5b3e9648d99
|
@@ -238,11 +238,15 @@ class Chef
|
|
238
238
|
# Upload the admins group and billing-admins acls
|
239
239
|
puts "Restoring the org admin data"
|
240
240
|
chef_fs_config = ::ChefFS::Config.new
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
241
|
+
|
242
|
+
# Restore users w/o clients (which don't exist yet)
|
243
|
+
['admins', 'billing-admins'].each do |group|
|
244
|
+
restore_group(chef_fs_config, group, :clients => false)
|
245
|
+
end
|
246
|
+
|
247
|
+
pattern = ::ChefFS::FilePattern.new('/acls/groups/billing-admins.json')
|
248
|
+
if ::ChefFS::FileSystem.copy_to(pattern, chef_fs_config.local_fs, chef_fs_config.chef_fs, nil, config, ui, proc { |entry| chef_fs_config.format_path(entry) })
|
249
|
+
@error = true
|
246
250
|
end
|
247
251
|
|
248
252
|
# Figure out who the admin is so we can spoof him and retrieve his stuff
|
@@ -270,6 +274,10 @@ class Chef
|
|
270
274
|
(top_level_paths + group_paths + group_acl_paths + acl_paths).each do |path|
|
271
275
|
::ChefFS::FileSystem.copy_to(::ChefFS::FilePattern.new(path), chef_fs_config.local_fs, chef_fs_config.chef_fs, nil, config, ui, proc { |entry| chef_fs_config.format_path(entry) })
|
272
276
|
end
|
277
|
+
# restore clients to groups
|
278
|
+
['admins', 'billing-admins'].each do |group|
|
279
|
+
restore_group(chef_fs_config, group, :users => false)
|
280
|
+
end
|
273
281
|
ensure
|
274
282
|
CONFIG_VARS.each do |key|
|
275
283
|
Chef::Config[key.to_sym] = old_config[key]
|
@@ -277,6 +285,33 @@ class Chef
|
|
277
285
|
end
|
278
286
|
end
|
279
287
|
|
288
|
+
def restore_group(chef_fs_config, group_name, includes = {:users => true, :clients => true})
|
289
|
+
includes[:users] = true unless includes.key? :users
|
290
|
+
includes[:clients] = true unless includes.key? :clients
|
291
|
+
|
292
|
+
group = ::ChefFS::FileSystem.resolve_path(
|
293
|
+
chef_fs_config.chef_fs,
|
294
|
+
"/groups/#{group_name}.json"
|
295
|
+
)
|
296
|
+
|
297
|
+
members_json = ::ChefFS::FileSystem.resolve_path(
|
298
|
+
chef_fs_config.local_fs,
|
299
|
+
"/groups/#{group_name}.json"
|
300
|
+
).read
|
301
|
+
|
302
|
+
members = JSON.parse(members_json).select do |member|
|
303
|
+
if includes[:users] and includes[:clients]
|
304
|
+
member
|
305
|
+
elsif includes[:users]
|
306
|
+
member == 'users'
|
307
|
+
elsif includes[:clients]
|
308
|
+
member == 'clients'
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
group.write(members.to_json)
|
313
|
+
end
|
314
|
+
|
280
315
|
def parallelize(entries, options = {}, &block)
|
281
316
|
::ChefFS::Parallelizer.parallelize(entries, options, &block)
|
282
317
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-ec-backup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|