knife-ec-backup 0.9.2 → 0.9.3

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: b2d0dc307ee907f00f7887f2ef46cb27aecefcf4
4
- data.tar.gz: abb5652ac51d594b2f2749a599b6f5decba542b1
3
+ metadata.gz: c64485c8411324223a9453e39e68afbd7a834aa2
4
+ data.tar.gz: 904be6ea0754370384521c07d90578fa70ca4513
5
5
  SHA512:
6
- metadata.gz: 111b7aeebdc6ba42a2b61df54a73f1bf8655a5b23dd5de777362e9d42ecb3b1f3fbcd8b5b3c03e6933d4f38ad92a8322f5ca405e50a4f1d2918120ffe6081645
7
- data.tar.gz: f1fc9a102464d737fe314dd78f7f0e7e8482a7809d8f858ee6992548f1950f17121996b739168a170135c70497c867993b2a29a7490fd236f59587300b3412ec
6
+ metadata.gz: 084f0ac8b43a0cd0139dd97c2a41e7840641bbca0589bba38a388845ca98857446c2f147e336a7943966804facf8949f27133b986e13480fbba8b314536a9970
7
+ data.tar.gz: 1e8489c6d5da29a0fd2bd6f8697cf78fe198905efbde6dfecd75ae4c586727552bcb2c969af634af376ddd3eac24fd13ba7e52a491fe399e4e91234ca2f92bda
@@ -21,16 +21,23 @@ class Chef
21
21
  webui_key = name_args[1]
22
22
  rest = Chef::REST.new(Chef::Config.chef_server_url)
23
23
  if name_args.length >= 3
24
- user_acl_rest = Chef::REST.new(name_args[3])
24
+ user_acl_rest = Chef::REST.new(name_args[2])
25
+ else
26
+ user_acl_rest = rest
25
27
  end
28
+
26
29
  # Grab users
30
+ puts "Grabbing users ..."
27
31
  ensure_dir("#{dest_dir}/users")
32
+ ensure_dir("#{dest_dir}/user_acls")
28
33
 
29
- puts "Grabbing users ..."
30
34
  rest.get_rest('/users').each_pair do |name, url|
31
35
  File.open("#{dest_dir}/users/#{name}.json", 'w') do |file|
32
36
  file.write(rest.get_rest(url).to_json)
33
37
  end
38
+ File.open("#{dest_dir}/user_acls/#{name}.json", 'w') do |file|
39
+ file.write(user_acl_rest.get_rest("users/#{name}/_acl").to_json)
40
+ end
34
41
  end
35
42
 
36
43
  # Download organizations
@@ -74,6 +81,7 @@ class Chef
74
81
  Chef::Config.chef_server_url = "#{Chef::Config.chef_server_url}/organizations/#{name}"
75
82
 
76
83
  # Figure out who the admin is so we can spoof him and retrieve his stuff
84
+ rest = Chef::REST.new(Chef::Config.chef_server_url)
77
85
  admin_users = rest.get_rest('groups/admins')['users']
78
86
  org_members = rest.get_rest('users').map { |user| user['user']['username'] }
79
87
  admin_users.delete_if { |user| !org_members.include?(user) }
@@ -83,9 +91,9 @@ class Chef
83
91
 
84
92
  # Do the download
85
93
  ensure_dir(Chef::Config.chef_repo_path)
86
- @chef_fs_config ||= ::ChefFS::Config.new
94
+ chef_fs_config ||= ::ChefFS::Config.new
87
95
  root_pattern = ::ChefFS::FilePattern.new('/')
88
- if ::ChefFS::FileSystem.copy_to(root_pattern, @chef_fs_config.chef_fs, @chef_fs_config.local_fs, nil, config, ui, proc { |entry| @chef_fs_config.format_path(entry) })
96
+ if ::ChefFS::FileSystem.copy_to(root_pattern, chef_fs_config.chef_fs, chef_fs_config.local_fs, nil, config, ui, proc { |entry| chef_fs_config.format_path(entry) })
89
97
  @error = true
90
98
  end
91
99
  ensure
@@ -2,8 +2,8 @@ require 'chef/knife'
2
2
 
3
3
  class Chef
4
4
  class Knife
5
- class OpcRestore < Chef::Knife
6
- banner "knife opc restore"
5
+ class EcRestore < Chef::Knife
6
+ banner "knife ec restore"
7
7
 
8
8
  deps do
9
9
  require 'chef_fs/config'
@@ -1,3 +1,3 @@
1
1
  module KnifeECBackup
2
- VERSION = '0.9.2'
2
+ VERSION = '0.9.3'
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.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser