knife-ec-backup 0.9.4 → 0.9.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c285a56c4950610acb55aa11b686076df1a82b2
4
- data.tar.gz: 5e6b0e50898af2481631db6703072bfd9708621a
3
+ metadata.gz: 82f59d873c1202c42f7ddebd1e673b102f81fda2
4
+ data.tar.gz: f2826c7bb0ec69ae9ca0d40c1e455dadbc91e649
5
5
  SHA512:
6
- metadata.gz: a0422cabb085a15ddf31b14a0eb53e169c184844a8ccd11091d2c8678355130d4fd99adde97ed4afb9a880b56652347b0f1b1ab948b5ab3e293234e59a37929b
7
- data.tar.gz: 4fa91e9ebb1a1b5f5ebe8f1b7e03adb692b8e53cf8f897cc973e811ee9b48c242d046164f7547c7e5981aed050f3f469b9c0b4a3edf7d1dd0ff2f8b7b2fbb26d
6
+ metadata.gz: 70ac26a02971b3b50184d9dd7d12c12233c0d7f33cd5097c366c9eef05ae3cc78845cd482cf28dbb3e8a477bc9142422f9894739a7caff7e59976ebc139f5447
7
+ data.tar.gz: cc3613d5eff4101a212c59f34f6a3ad736c0cce305501db4c41fc7dead3b0e11fb1912b564f15aecbb03a5aefdb5cfcb1ac9387271492ca17859f44bf00807c8
@@ -5,10 +5,21 @@ class Chef
5
5
  class EcBackup < Chef::Knife
6
6
  banner "knife ec backup"
7
7
 
8
+ option :concurrency,
9
+ :long => '--concurrency THREADS',
10
+ :description => 'Maximum number of simultaneous requests to send (default: 10)'
11
+
8
12
  deps do
9
13
  require 'chef_fs/config'
10
14
  require 'chef_fs/file_system'
11
15
  require 'chef_fs/file_pattern'
16
+ require 'chef_fs/parallelizer'
17
+ end
18
+
19
+ def configure_chef
20
+ super
21
+ Chef::Config[:concurrency] = config[:concurrency].to_i if config[:concurrency]
22
+ ::ChefFS::Parallelizer.threads = (Chef::Config[:concurrency] || 10) - 1
12
23
  end
13
24
 
14
25
  def run
@@ -5,6 +5,16 @@ class Chef
5
5
  class EcRestore < Chef::Knife
6
6
  banner "knife ec restore"
7
7
 
8
+ option :concurrency,
9
+ :long => '--concurrency THREADS',
10
+ :description => 'Maximum number of simultaneous requests to send (default: 10)'
11
+
12
+ option :overwrite_pivotal,
13
+ :long => '--overwrite-pivotal',
14
+ :boolean => true,
15
+ :default => false,
16
+ :description => "Whether to overwrite pivotal's key. Once this is done, future requests will fail until you fix the private key."
17
+
8
18
  deps do
9
19
  require 'chef/json_compat'
10
20
  require 'chef_fs/config'
@@ -16,6 +26,12 @@ class Chef
16
26
  require 'chef_fs/parallelizer'
17
27
  end
18
28
 
29
+ def configure_chef
30
+ super
31
+ Chef::Config[:concurrency] = config[:concurrency].to_i if config[:concurrency]
32
+ ::ChefFS::Parallelizer.threads = (Chef::Config[:concurrency] || 10) - 1
33
+ end
34
+
19
35
  def run
20
36
  if name_args.length == 0
21
37
  ui.error("Must specify backup directory as argument.")
@@ -36,8 +52,15 @@ class Chef
36
52
  Dir.foreach("#{dest_dir}/users") do |filename|
37
53
  next if filename !~ /(.+)\.json/
38
54
  name = $1
55
+ if name == 'pivotal' && !config[:overwrite_pivotal]
56
+ ui.warn("Skipping pivotal update. To overwrite pivotal, pass --overwrite-pivotal. Once pivotal is updated, you will need to modify #{Chef::Config.client_key} to be the corresponding private key.")
57
+ next
58
+ end
59
+
60
+ # Update user object
39
61
  user = JSONCompat.from_json(IO.read("#{dest_dir}/users/#{name}.json"))
40
62
  begin
63
+ # Supply password for new user
41
64
  user_with_password = user.dup
42
65
  user_with_password['password'] = SecureRandom.hex
43
66
  rest.post_rest('users', user_with_password)
@@ -48,7 +71,9 @@ class Chef
48
71
  raise
49
72
  end
50
73
  end
51
- # Doesn't work at present
74
+
75
+ # Update user acl
76
+ # Doesn't work at present due to server
52
77
  #user_acl = JSONCompat.from_json(IO.read("#{dest_dir}/user_acls/#{name}.json"))
53
78
  #put_acl(user_acl_rest, "users/#{name}/_acl", user_acl)
54
79
  end
@@ -1,3 +1,3 @@
1
1
  module KnifeECBackup
2
- VERSION = '0.9.4'
2
+ VERSION = '0.9.5'
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.4
4
+ version: 0.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser