knife-tidy 0.4.0 → 0.4.1
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/CHANGELOG.md +8 -0
- data/lib/chef/knife/tidy_backup_clean.rb +23 -0
- data/lib/chef/tidy_common.rb +4 -0
- data/lib/knife-tidy/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: fdd8bded909178ab1e6055a4415dc0c675ee0441
|
4
|
+
data.tar.gz: 52b73bfc270082947f232fd333ecdd900bac2ac7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e843f9db36f6baf438c500ff2fd52b8e7e7151f06391597c3809dd52b4bf89124ba7a9cd2579d090c1eb9280b92145ff09a2738a799275cbb4bfb8de75b1865e
|
7
|
+
data.tar.gz: 7dcb30b9c176ccb3b087cbecdfdbe4ec03854c32643eb7de6b7592a24ae1d58a7b8009a3ce1ab0f38ddcab16114f9eae005ee6505958c4c4987a1f80133d5278
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [0.4.1](https://github.com/chef-customers/knife-tidy/tree/0.4.1) (2017-09-27)
|
4
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.4.0...0.4.1)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- fixing corrupt invitations and invalid platform names with commas in … [\#38](https://github.com/chef-customers/knife-tidy/pull/38) ([jeremymv2](https://github.com/jeremymv2))
|
9
|
+
- bump to 0.4.0 [\#36](https://github.com/chef-customers/knife-tidy/pull/36) ([jeremymv2](https://github.com/jeremymv2))
|
10
|
+
|
3
11
|
## [0.4.0](https://github.com/chef-customers/knife-tidy/tree/0.4.0) (2017-09-26)
|
4
12
|
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.6...0.4.0)
|
5
13
|
|
@@ -51,6 +51,7 @@ class Chef
|
|
51
51
|
|
52
52
|
orgs.each do |org|
|
53
53
|
fix_org_object(org)
|
54
|
+
validate_invitations(org)
|
54
55
|
validate_roles(org)
|
55
56
|
org_acls = Chef::TidyOrgAcls.new(tidy, org)
|
56
57
|
org_acls.validate_acls
|
@@ -213,6 +214,8 @@ class Chef
|
|
213
214
|
end
|
214
215
|
if metadata.has_key?('platforms')
|
215
216
|
metadata['platforms'].each_pair do |key, value|
|
217
|
+
# platform key cannot contain comma delimited values
|
218
|
+
md['platforms'].delete(key) if key =~ /,/
|
216
219
|
if value.kind_of?(Array) && value.empty?
|
217
220
|
puts "REPAIRING: Fixing empty platform key for for key #{key} in #{json_path}"
|
218
221
|
md['platforms'][key] = '>= 0.0.0'
|
@@ -365,6 +368,26 @@ class Chef
|
|
365
368
|
end
|
366
369
|
end
|
367
370
|
end
|
371
|
+
|
372
|
+
def validate_invitations(org)
|
373
|
+
invite_file = tidy.invitations_path(org)
|
374
|
+
puts "INFO: validating org #{org} invites in #{invite_file}"
|
375
|
+
invitations = FFI_Yajl::Parser.parse(::File.read(invite_file), symbolize_names: false)
|
376
|
+
invitations_new = []
|
377
|
+
invitations.each do |invite|
|
378
|
+
if invite['username'].nil?
|
379
|
+
puts "REPAIRING: Dropping corrupt invitations for #{org} in file #{invite_file}"
|
380
|
+
else
|
381
|
+
invite_hash = {}
|
382
|
+
invite_hash['id'] = invite['id']
|
383
|
+
invite_hash['username'] = invite['username']
|
384
|
+
invitations_new.push(invite_hash)
|
385
|
+
end
|
386
|
+
end
|
387
|
+
::File.open(invite_file, 'w') do |f|
|
388
|
+
f.write(Chef::JSONCompat.to_json_pretty(invitations_new))
|
389
|
+
end
|
390
|
+
end
|
368
391
|
end
|
369
392
|
end
|
370
393
|
end
|
data/lib/chef/tidy_common.rb
CHANGED
@@ -17,6 +17,10 @@ class Chef
|
|
17
17
|
::File.expand_path(::File.join(@backup_path, 'organizations', org, 'members.json'))
|
18
18
|
end
|
19
19
|
|
20
|
+
def invitations_path(org)
|
21
|
+
::File.expand_path(::File.join(@backup_path, 'organizations', org, 'invitations.json'))
|
22
|
+
end
|
23
|
+
|
20
24
|
def clients_path(org)
|
21
25
|
::File.expand_path(::File.join(@backup_path, 'organizations', org, 'clients'))
|
22
26
|
end
|
data/lib/knife-tidy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-tidy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|