knife-ec-backup 2.4.7 → 2.4.12
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 +4 -4
- data/README.md +19 -24
- data/Rakefile +1 -1
- data/lib/chef/knife/ec_backup.rb +3 -3
- data/lib/chef/knife/ec_base.rb +1 -1
- data/lib/chef/knife/ec_key_base.rb +1 -1
- data/lib/chef/knife/ec_key_import.rb +1 -1
- data/lib/chef/knife/ec_restore.rb +2 -2
- data/lib/chef/server.rb +2 -2
- data/lib/knife_ec_backup/version.rb +1 -1
- data/spec/chef/knife/ec_base_spec.rb +1 -1
- data/spec/chef/knife/ec_key_export_spec.rb +2 -2
- data/spec/chef/knife/ec_restore_spec.rb +1 -1
- data/spec/chef/server_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312e0c84f3b2b40b6a2824917e31da481007f65f1b82282a18ec441e398220bd
|
4
|
+
data.tar.gz: e2f1962db8526925402afcf73c145f04ffda47263fa8bade5064c2d50f494c3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16f96728387157fad3ef2fe38c18c9597c8c2fc2b6cb295262a7c161fc52d2fddaa40b38e38ad3e4c39af22fbec8dbf4c3bce74b8b0c97da7b22994e3cc2e7c9
|
7
|
+
data.tar.gz: e8bb31bc8fde89b682b2ab3dd8c89c7bc9b885af3f9e21d30e1e3e3875f8beea9ccb228fb3e6c8909300cf79c6bfe24e799b83af85b83b3d0ec348f59959466b
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Knife EC Backup
|
2
|
-
[](https://buildkite.com/chef-oss/chef-knife-ec-backup-master-verify)
|
3
3
|
[](https://badge.fury.io/rb/knife-ec-backup)
|
4
4
|
|
5
5
|
**Umbrella Project**: [Knife](https://github.com/chef/chef-oss-practices/blob/master/projects/knife.md)
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
**Pull Request [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md)**: 14 days
|
12
12
|
|
13
|
-
|
13
|
+
## Description
|
14
14
|
|
15
15
|
knife-ec-backup can backup and restore the data in an Enterprise Chef
|
16
16
|
Server installation, preserving the data in an intermediate, editable
|
@@ -21,26 +21,21 @@ Server API deficiencies. The long-run goal is to improve `knife
|
|
21
21
|
download`, `knife upload` and the Chef Server API and deprecate this
|
22
22
|
tool.
|
23
23
|
|
24
|
-
|
24
|
+
## Requirements
|
25
25
|
|
26
26
|
This knife plugin requires Chef Client 11.8+.
|
27
27
|
|
28
|
-
|
28
|
+
### Server Support
|
29
29
|
|
30
|
-
|
31
|
-
of this gem. Version 1.x additionally depends on knife-essentials.
|
32
|
-
|
33
|
-
## Server Support
|
34
|
-
|
35
|
-
This plugin currently supports Enterprise Chef 11 and Chef Server 12.
|
30
|
+
This plugin currently supports Enterprise Chef 11 and Chef Server 12+.
|
36
31
|
Support for the beta key rotation features is provided via the
|
37
32
|
`--with-keys-sql` flag, but users of this feature should note that
|
38
33
|
this may change once the Chef Server supports an API-based export of
|
39
34
|
the key data.
|
40
35
|
|
41
|
-
|
36
|
+
## Installation
|
42
37
|
|
43
|
-
|
38
|
+
### Chef Server Install (Recommended)
|
44
39
|
|
45
40
|
This gem is installed with chef-server-core 12.0.0 and newer.
|
46
41
|
|
@@ -53,7 +48,7 @@ downloading the .zip file. Once unpacked, run:
|
|
53
48
|
/opt/opscode/embedded/bin/gem install knife-ec-backup*gem --no-ri --no-rdoc -V
|
54
49
|
```
|
55
50
|
|
56
|
-
|
51
|
+
#### Note on installing with existing development tools:
|
57
52
|
|
58
53
|
The latest versions of knife-ec-backup require gems with native
|
59
54
|
extensions, thus you must install a standard build toolchain. To
|
@@ -84,17 +79,17 @@ Clone the git repository and run the following from inside:
|
|
84
79
|
gem build knife-ec-backup.gemspec
|
85
80
|
gem install knife-ec-backup*gem
|
86
81
|
|
87
|
-
|
82
|
+
## Configuration
|
88
83
|
|
89
|
-
|
84
|
+
### Permissions
|
90
85
|
|
91
86
|
Note that most users in an EC installation lack the permissions to pull all of the data from all organizations and other users.
|
92
87
|
This plugin **REQUIRES THE PIVOTAL KEY AND WEBUI KEY** from the Chef Server.
|
93
88
|
It is recommended that you run this from a frontend Enterprise Chef Server, you can use --user and --key to pass the pivotal information along.
|
94
89
|
|
95
|
-
|
90
|
+
## Subcommands
|
96
91
|
|
97
|
-
|
92
|
+
### Common Options
|
98
93
|
|
99
94
|
The following options are supported across all subcommands:
|
100
95
|
|
@@ -122,7 +117,7 @@ The following options are supported across all subcommands:
|
|
122
117
|
* `--dry-run`:
|
123
118
|
Report what actions would be taken without performing any. (default: false)
|
124
119
|
|
125
|
-
|
120
|
+
### knife ec backup DEST_DIR (options)
|
126
121
|
|
127
122
|
*Path*: If you have chef-client installed as well, you may need to invoke this as `/opt/opscode/embedded/bin/knife ec backup backup`
|
128
123
|
|
@@ -214,7 +209,7 @@ This compares very closely with the "knife download /" from an OSC server:
|
|
214
209
|
users
|
215
210
|
<name>.json>
|
216
211
|
|
217
|
-
|
212
|
+
### knife ec restore DEST_DIR (options)
|
218
213
|
|
219
214
|
Restores all data from the specified DEST_DIR to an Enterprise Chef /
|
220
215
|
Private Chef server. DEST_DIR should be a backup directory created by
|
@@ -243,7 +238,7 @@ Private Chef server. DEST_DIR should be a backup directory created by
|
|
243
238
|
also skip any auto-configured options (default: false)
|
244
239
|
|
245
240
|
* `--[no-]skip-user-ids`:
|
246
|
-
Reuses user ids from the restore destination when updating existing
|
241
|
+
Reuses user ids from the restore destination when updating existing
|
247
242
|
users to avoid database conflicts (default: true)
|
248
243
|
|
249
244
|
* `--with-user-sql`:
|
@@ -268,10 +263,10 @@ Private Chef server. DEST_DIR should be a backup directory created by
|
|
268
263
|
Chef objects.
|
269
264
|
|
270
265
|
* `--only-org ORG`:
|
271
|
-
Only
|
266
|
+
Only download/restore objects in the named organization. Global
|
272
267
|
objects such as users will still be downloaded/restored.
|
273
268
|
|
274
|
-
|
269
|
+
### knife ec key export [FILENAME]
|
275
270
|
|
276
271
|
Create a json representation of the users table from the Chef Server
|
277
272
|
database. If no argument is given, the name of the backup is
|
@@ -280,7 +275,7 @@ database. If no argument is given, the name of the backup is
|
|
280
275
|
Please note, most users should use `knife ec backup` with the
|
281
276
|
`--with-user-sql` option rather than this command.
|
282
277
|
|
283
|
-
|
278
|
+
### knife ec key import [FILENAME]
|
284
279
|
|
285
280
|
Import a json representation of the users table from FILENAME to the
|
286
281
|
the Chef Server database. If no argument is given, the filename is
|
@@ -289,7 +284,7 @@ assumed to be `key_dump.json`.
|
|
289
284
|
Please note, most user should use `knife ec restore` with the
|
290
285
|
`--with-user-sql` option rather than this command.
|
291
286
|
|
292
|
-
|
287
|
+
## Known Bugs
|
293
288
|
|
294
289
|
- knife-ec-backup cannot be installed in the embedded gemset of Chef
|
295
290
|
Server 12. This will be resolved in a future Chef Server release.
|
data/Rakefile
CHANGED
data/lib/chef/knife/ec_backup.rb
CHANGED
@@ -15,7 +15,7 @@ class Chef
|
|
15
15
|
require 'chef/chef_fs/file_pattern'
|
16
16
|
require 'chef/chef_fs/parallelizer'
|
17
17
|
require_relative '../server'
|
18
|
-
require 'fileutils'
|
18
|
+
require 'fileutils' unless defined?(FileUtils)
|
19
19
|
end
|
20
20
|
|
21
21
|
def run
|
@@ -96,10 +96,10 @@ class Chef
|
|
96
96
|
knife_ec_error_handler.add(ex)
|
97
97
|
next
|
98
98
|
end
|
99
|
-
# Enterprise Chef 11 and below uses a pool of
|
99
|
+
# Enterprise Chef 11 and below uses a pool of pre-created
|
100
100
|
# organizations to account for slow organization creation
|
101
101
|
# using CouchDB. Thus, on server versions < 12 we want to
|
102
|
-
# skip any of these
|
102
|
+
# skip any of these pre-created organizations by checking if
|
103
103
|
# they have been assigned or not. The Chef 12 API does not
|
104
104
|
# return an assigned_at field.
|
105
105
|
if org['assigned_at'] || server.version >= Gem::Version.new("12")
|
data/lib/chef/knife/ec_base.rb
CHANGED
@@ -184,7 +184,7 @@ class Chef
|
|
184
184
|
d.delete('id') if config[:skip_ids]
|
185
185
|
# If the hash_type in the export,
|
186
186
|
# we are dealing with a record where the password is still in the
|
187
|
-
#
|
187
|
+
# serialized_object. Explicitly setting these to nil ensures that the
|
188
188
|
# password set in the restore is wiped out.
|
189
189
|
unless d.has_key?('hash_type')
|
190
190
|
d['hash_type'] = nil
|
@@ -33,7 +33,7 @@ class Chef
|
|
33
33
|
# Work around bug in chef_fs
|
34
34
|
require 'chef/chef_fs/command_line'
|
35
35
|
require 'chef/chef_fs/data_handler/acl_data_handler'
|
36
|
-
require 'securerandom'
|
36
|
+
require 'securerandom' unless defined?(SecureRandom)
|
37
37
|
require 'chef/chef_fs/parallelizer'
|
38
38
|
require_relative '../tsorter'
|
39
39
|
require_relative '../server'
|
@@ -229,7 +229,7 @@ class Chef
|
|
229
229
|
ui.msg "Restoring org admin data"
|
230
230
|
chef_fs_config = Chef::ChefFS::Config.new
|
231
231
|
|
232
|
-
# Handle Admins, Billing Admins and Public Key Read Access
|
232
|
+
# Handle Admins, Billing Admins and Public Key Read Access separately
|
233
233
|
#
|
234
234
|
# admins: We need to upload admins first so that we
|
235
235
|
# can upload all of the other objects as a user in the org
|
data/lib/chef/server.rb
CHANGED
@@ -2,7 +2,7 @@ require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_hel
|
|
2
2
|
require 'chef/knife/ec_base'
|
3
3
|
require 'chef/knife'
|
4
4
|
require 'chef/config'
|
5
|
-
require 'stringio'
|
5
|
+
require 'stringio' unless defined?(StringIO)
|
6
6
|
|
7
7
|
class Tester < Chef::Knife
|
8
8
|
include Chef::Knife::EcBase
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
|
2
2
|
require 'chef/knife/ec_key_export'
|
3
3
|
require 'sequel'
|
4
|
-
require 'json'
|
5
|
-
require 'securerandom'
|
4
|
+
require 'json' unless defined?(JSON)
|
5
|
+
require 'securerandom' unless defined?(SecureRandom)
|
6
6
|
require 'fakefs/spec_helpers'
|
7
7
|
|
8
8
|
def user_record(name)
|
@@ -58,7 +58,7 @@ describe Chef::Knife::EcRestore do
|
|
58
58
|
@knife.restore_open_invitations("foo")
|
59
59
|
end
|
60
60
|
|
61
|
-
it "does NOT fail if an
|
61
|
+
it "does NOT fail if an invitation already exists" do
|
62
62
|
make_org "foo"
|
63
63
|
allow(@rest).to receive(:post).with("organizations/foo/association_requests", {"user" => "bob"}).and_return(net_exception(409))
|
64
64
|
allow(@rest).to receive(:post).with("organizations/foo/association_requests", {"user" => "jane"}).and_return(net_exception(409))
|
data/spec/chef/server_spec.rb
CHANGED
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: 2.4.
|
4
|
+
version: 2.4.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|