knife-tidy 1.1.0 → 1.2.0
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 +225 -3
- data/README.md +2 -0
- data/lib/chef/knife/tidy_backup_clean.rb +15 -0
- data/lib/chef/tidy_common.rb +4 -0
- data/lib/knife-tidy/version.rb +1 -1
- data/spec/chef/knife/tidy_backup_clean_spec.rb +0 -24
- data/spec/chef/knife/tidy_base_spec.rb +7 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe2a778de3020252562b8788aca9ad4c2a84c50621b1659c867b7b5b5db89d5e
|
4
|
+
data.tar.gz: b305e31422e5cf415021bed9a0e3251550d6962b5ed0ba75a98c213741e2f077
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0edc9e58ccd32ba959e0cdc1f1200b937459f0daad9547f302f4878da2d889a626b0dcedd8b90e8515e0c425f298ad3daa2a0169ba62530865dd998a85a69a0
|
7
|
+
data.tar.gz: 980af3d17bb27eb7cf060e9e56c0f8419a9e3f557b78702ed3ef05106cf2dbf4323f025bbdf3cc76ae24bc50d71e98c51c45b9b99892ffd9c7adc7117ced2884
|
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [1.
|
4
|
-
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/1.1.0...1.
|
3
|
+
## [1.2.0](https://github.com/chef-customers/knife-tidy/tree/1.2.0) (2018-05-17)
|
4
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/1.1.0...1.2.0)
|
5
5
|
|
6
6
|
**Closed issues:**
|
7
7
|
|
8
8
|
- notifications fail for chef orgs containing an underscore [\#77](https://github.com/chef-customers/knife-tidy/issues/77)
|
9
9
|
- Add option to attach raw JSON report files to the email notification [\#75](https://github.com/chef-customers/knife-tidy/issues/75)
|
10
10
|
|
11
|
+
**Merged pull requests:**
|
12
|
+
|
13
|
+
- bump to 1.2.0 [\#85](https://github.com/chef-customers/knife-tidy/pull/85) ([jeremymv2](https://github.com/jeremymv2))
|
14
|
+
- fix empty clients group [\#84](https://github.com/chef-customers/knife-tidy/pull/84) ([jeremymv2](https://github.com/jeremymv2))
|
15
|
+
|
11
16
|
## [1.1.0](https://github.com/chef-customers/knife-tidy/tree/1.1.0) (2018-01-11)
|
12
17
|
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/1.0.1...1.1.0)
|
13
18
|
|
@@ -19,6 +24,223 @@
|
|
19
24
|
|
20
25
|
- Jjh/fix notification reports [\#80](https://github.com/chef-customers/knife-tidy/pull/80) ([itmustbejj](https://github.com/itmustbejj))
|
21
26
|
|
27
|
+
## [1.0.1](https://github.com/chef-customers/knife-tidy/tree/1.0.1) (2017-12-12)
|
28
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/1.0.0...1.0.1)
|
29
|
+
|
30
|
+
**Closed issues:**
|
31
|
+
|
32
|
+
- Clean up references to tidy methods [\#68](https://github.com/chef-customers/knife-tidy/issues/68)
|
33
|
+
- A stale search index can generate inaccurate tidy reports [\#62](https://github.com/chef-customers/knife-tidy/issues/62)
|
34
|
+
|
35
|
+
**Merged pull requests:**
|
36
|
+
|
37
|
+
- Fix validate\_user\_acls and default\_user\_acl methods [\#73](https://github.com/chef-customers/knife-tidy/pull/73) ([itmustbejj](https://github.com/itmustbejj))
|
38
|
+
|
39
|
+
## [1.0.0](https://github.com/chef-customers/knife-tidy/tree/1.0.0) (2017-12-04)
|
40
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.7.0...1.0.0)
|
41
|
+
|
42
|
+
**Merged pull requests:**
|
43
|
+
|
44
|
+
- Enabled cookbook deletion [\#71](https://github.com/chef-customers/knife-tidy/pull/71) ([itmustbejj](https://github.com/itmustbejj))
|
45
|
+
- Add option for backup path to server clean [\#70](https://github.com/chef-customers/knife-tidy/pull/70) ([TheLunaticScripter](https://github.com/TheLunaticScripter))
|
46
|
+
- Warn the user if there are nodes created in the last hour that haven'… [\#67](https://github.com/chef-customers/knife-tidy/pull/67) ([itmustbejj](https://github.com/itmustbejj))
|
47
|
+
- Add guard to skip generating org reports if the search index is not u… [\#66](https://github.com/chef-customers/knife-tidy/pull/66) ([itmustbejj](https://github.com/itmustbejj))
|
48
|
+
- Enable server clean command and clarify confirmation dialogue [\#31](https://github.com/chef-customers/knife-tidy/pull/31) ([jonlives](https://github.com/jonlives))
|
49
|
+
|
50
|
+
## [0.7.0](https://github.com/chef-customers/knife-tidy/tree/0.7.0) (2017-11-29)
|
51
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.6.1...0.7.0)
|
52
|
+
|
53
|
+
**Closed issues:**
|
54
|
+
|
55
|
+
- Users/clients from backups older than CS 12.5 may be missing read acls on clients [\#63](https://github.com/chef-customers/knife-tidy/issues/63)
|
56
|
+
- notify subcommand ignores --orgs option [\#59](https://github.com/chef-customers/knife-tidy/issues/59)
|
57
|
+
|
58
|
+
**Merged pull requests:**
|
59
|
+
|
60
|
+
- release 0.7.0 [\#65](https://github.com/chef-customers/knife-tidy/pull/65) ([jeremymv2](https://github.com/jeremymv2))
|
61
|
+
- Add admins/users groups to the read acl for clients from \< CS 12.5 [\#64](https://github.com/chef-customers/knife-tidy/pull/64) ([itmustbejj](https://github.com/itmustbejj))
|
62
|
+
- Restore acls for ::server-admins and org read access groups if they a… [\#61](https://github.com/chef-customers/knife-tidy/pull/61) ([itmustbejj](https://github.com/itmustbejj))
|
63
|
+
- Filter email notifications on org\_list config option. [\#60](https://github.com/chef-customers/knife-tidy/pull/60) ([itmustbejj](https://github.com/itmustbejj))
|
64
|
+
- Set default encoding to utf-8 to properly handle non-ascii in backups. [\#58](https://github.com/chef-customers/knife-tidy/pull/58) ([itmustbejj](https://github.com/itmustbejj))
|
65
|
+
- Add check for pre-12.3 nodes to report generation… [\#57](https://github.com/chef-customers/knife-tidy/pull/57) ([jonlives](https://github.com/jonlives))
|
66
|
+
- bump path to 0.6.1 [\#55](https://github.com/chef-customers/knife-tidy/pull/55) ([jeremymv2](https://github.com/jeremymv2))
|
67
|
+
|
68
|
+
## [0.6.1](https://github.com/chef-customers/knife-tidy/tree/0.6.1) (2017-10-26)
|
69
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.6.0...0.6.1)
|
70
|
+
|
71
|
+
**Closed issues:**
|
72
|
+
|
73
|
+
- knife tidy server clean - org names with \_ [\#53](https://github.com/chef-customers/knife-tidy/issues/53)
|
74
|
+
|
75
|
+
**Merged pull requests:**
|
76
|
+
|
77
|
+
- fixing orgs with underscores [\#54](https://github.com/chef-customers/knife-tidy/pull/54) ([jeremymv2](https://github.com/jeremymv2))
|
78
|
+
- Jeremymv2/release 0 6 0 [\#52](https://github.com/chef-customers/knife-tidy/pull/52) ([jeremymv2](https://github.com/jeremymv2))
|
79
|
+
|
80
|
+
## [0.6.0](https://github.com/chef-customers/knife-tidy/tree/0.6.0) (2017-10-23)
|
81
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.5.2...0.6.0)
|
82
|
+
|
83
|
+
**Merged pull requests:**
|
84
|
+
|
85
|
+
- fix travis [\#51](https://github.com/chef-customers/knife-tidy/pull/51) ([jeremymv2](https://github.com/jeremymv2))
|
86
|
+
- Add knife tidy notify command [\#50](https://github.com/chef-customers/knife-tidy/pull/50) ([jonlives](https://github.com/jonlives))
|
87
|
+
- bump to 0.5.2 [\#49](https://github.com/chef-customers/knife-tidy/pull/49) ([jeremymv2](https://github.com/jeremymv2))
|
88
|
+
|
89
|
+
## [0.5.2](https://github.com/chef-customers/knife-tidy/tree/0.5.2) (2017-10-20)
|
90
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.5.1...0.5.2)
|
91
|
+
|
92
|
+
**Merged pull requests:**
|
93
|
+
|
94
|
+
- fixing regex for whitespace [\#48](https://github.com/chef-customers/knife-tidy/pull/48) ([jeremymv2](https://github.com/jeremymv2))
|
95
|
+
- bump patch to 0.5.1 [\#47](https://github.com/chef-customers/knife-tidy/pull/47) ([jeremymv2](https://github.com/jeremymv2))
|
96
|
+
|
97
|
+
## [0.5.1](https://github.com/chef-customers/knife-tidy/tree/0.5.1) (2017-10-19)
|
98
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.5.0...0.5.1)
|
99
|
+
|
100
|
+
**Merged pull requests:**
|
101
|
+
|
102
|
+
- Add node\_count to stale node json output. [\#46](https://github.com/chef-customers/knife-tidy/pull/46) ([MarkGibbons](https://github.com/MarkGibbons))
|
103
|
+
- bump to 0.5.0 [\#45](https://github.com/chef-customers/knife-tidy/pull/45) ([jeremymv2](https://github.com/jeremymv2))
|
104
|
+
|
105
|
+
## [0.5.0](https://github.com/chef-customers/knife-tidy/tree/0.5.0) (2017-10-06)
|
106
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.4.1...0.5.0)
|
107
|
+
|
108
|
+
**Closed issues:**
|
109
|
+
|
110
|
+
- Supermarket.chef.io [\#37](https://github.com/chef-customers/knife-tidy/issues/37)
|
111
|
+
|
112
|
+
**Merged pull requests:**
|
113
|
+
|
114
|
+
- enabling deletion of stale nodes [\#44](https://github.com/chef-customers/knife-tidy/pull/44) ([jeremymv2](https://github.com/jeremymv2))
|
115
|
+
- better warning message before confirmation [\#43](https://github.com/chef-customers/knife-tidy/pull/43) ([jeremymv2](https://github.com/jeremymv2))
|
116
|
+
- Jeremymv2/chef sugar fix default [\#42](https://github.com/chef-customers/knife-tidy/pull/42) ([jeremymv2](https://github.com/jeremymv2))
|
117
|
+
- deleting nodes also deletes client [\#41](https://github.com/chef-customers/knife-tidy/pull/41) ([jeremymv2](https://github.com/jeremymv2))
|
118
|
+
- Change nodes\_list method to get all nodes [\#40](https://github.com/chef-customers/knife-tidy/pull/40) ([nsdavidson](https://github.com/nsdavidson))
|
119
|
+
- bump version to 0.4.1 [\#39](https://github.com/chef-customers/knife-tidy/pull/39) ([jeremymv2](https://github.com/jeremymv2))
|
120
|
+
|
121
|
+
## [0.4.1](https://github.com/chef-customers/knife-tidy/tree/0.4.1) (2017-09-27)
|
122
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.4.0...0.4.1)
|
123
|
+
|
124
|
+
**Merged pull requests:**
|
125
|
+
|
126
|
+
- 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))
|
127
|
+
- bump to 0.4.0 [\#36](https://github.com/chef-customers/knife-tidy/pull/36) ([jeremymv2](https://github.com/jeremymv2))
|
128
|
+
|
129
|
+
## [0.4.0](https://github.com/chef-customers/knife-tidy/tree/0.4.0) (2017-09-26)
|
130
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.6...0.4.0)
|
131
|
+
|
132
|
+
**Merged pull requests:**
|
133
|
+
|
134
|
+
- fix NilClass on env\_run\_lists [\#35](https://github.com/chef-customers/knife-tidy/pull/35) ([jeremymv2](https://github.com/jeremymv2))
|
135
|
+
- fix merge conflict from rebase [\#34](https://github.com/chef-customers/knife-tidy/pull/34) ([jeremymv2](https://github.com/jeremymv2))
|
136
|
+
- Simple feature to clean up EC11 org objects which don't load into CS12 [\#33](https://github.com/chef-customers/knife-tidy/pull/33) ([irvingpop](https://github.com/irvingpop))
|
137
|
+
- role run\_list clean up and metadata name regex simplification [\#32](https://github.com/chef-customers/knife-tidy/pull/32) ([jeremymv2](https://github.com/jeremymv2))
|
138
|
+
- bump to 0.3.6 [\#30](https://github.com/chef-customers/knife-tidy/pull/30) ([jeremymv2](https://github.com/jeremymv2))
|
139
|
+
|
140
|
+
## [0.3.6](https://github.com/chef-customers/knife-tidy/tree/0.3.6) (2017-09-25)
|
141
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.5...0.3.6)
|
142
|
+
|
143
|
+
**Merged pull requests:**
|
144
|
+
|
145
|
+
- first check if the\_user.has\_key?\('email'\) [\#29](https://github.com/chef-customers/knife-tidy/pull/29) ([jeremymv2](https://github.com/jeremymv2))
|
146
|
+
- bump to 0.3.5 [\#28](https://github.com/chef-customers/knife-tidy/pull/28) ([jeremymv2](https://github.com/jeremymv2))
|
147
|
+
|
148
|
+
## [0.3.5](https://github.com/chef-customers/knife-tidy/tree/0.3.5) (2017-09-20)
|
149
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.4...0.3.5)
|
150
|
+
|
151
|
+
**Merged pull requests:**
|
152
|
+
|
153
|
+
- Catch pins with no cookbooks [\#27](https://github.com/chef-customers/knife-tidy/pull/27) ([nsdavidson](https://github.com/nsdavidson))
|
154
|
+
|
155
|
+
## [0.3.4](https://github.com/chef-customers/knife-tidy/tree/0.3.4) (2017-09-16)
|
156
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.3...0.3.4)
|
157
|
+
|
158
|
+
**Merged pull requests:**
|
159
|
+
|
160
|
+
- check if metadata.has\_key?\('platforms'\) [\#26](https://github.com/chef-customers/knife-tidy/pull/26) ([jeremymv2](https://github.com/jeremymv2))
|
161
|
+
|
162
|
+
## [0.3.3](https://github.com/chef-customers/knife-tidy/tree/0.3.3) (2017-09-15)
|
163
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.2...0.3.3)
|
164
|
+
|
165
|
+
**Merged pull requests:**
|
166
|
+
|
167
|
+
- boiler plate gsub file now works [\#25](https://github.com/chef-customers/knife-tidy/pull/25) ([jeremymv2](https://github.com/jeremymv2))
|
168
|
+
- fixing null values and emtpy arrays in metadata.json [\#24](https://github.com/chef-customers/knife-tidy/pull/24) ([jeremymv2](https://github.com/jeremymv2))
|
169
|
+
- Jeremyv2/action needed notification [\#23](https://github.com/chef-customers/knife-tidy/pull/23) ([jeremymv2](https://github.com/jeremymv2))
|
170
|
+
|
171
|
+
## [0.3.2](https://github.com/chef-customers/knife-tidy/tree/0.3.2) (2017-09-14)
|
172
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.1...0.3.2)
|
173
|
+
|
174
|
+
**Merged pull requests:**
|
175
|
+
|
176
|
+
- fixed name mismatch in metadata.json [\#22](https://github.com/chef-customers/knife-tidy/pull/22) ([jeremymv2](https://github.com/jeremymv2))
|
177
|
+
|
178
|
+
## [0.3.1](https://github.com/chef-customers/knife-tidy/tree/0.3.1) (2017-09-14)
|
179
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.3.0...0.3.1)
|
180
|
+
|
181
|
+
**Merged pull requests:**
|
182
|
+
|
183
|
+
- generate a metadata.rb if needed [\#21](https://github.com/chef-customers/knife-tidy/pull/21) ([jeremymv2](https://github.com/jeremymv2))
|
184
|
+
- newline for action needed messages [\#20](https://github.com/chef-customers/knife-tidy/pull/20) ([jeremymv2](https://github.com/jeremymv2))
|
185
|
+
|
186
|
+
## [0.3.0](https://github.com/chef-customers/knife-tidy/tree/0.3.0) (2017-09-14)
|
187
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.2.4...0.3.0)
|
188
|
+
|
189
|
+
**Closed issues:**
|
190
|
+
|
191
|
+
- FATAL: Cannot find subcommand for: 'tidy backup clean' [\#12](https://github.com/chef-customers/knife-tidy/issues/12)
|
192
|
+
|
193
|
+
**Merged pull requests:**
|
194
|
+
|
195
|
+
- bump to 0.3.0 [\#19](https://github.com/chef-customers/knife-tidy/pull/19) ([jeremymv2](https://github.com/jeremymv2))
|
196
|
+
- added dry-run to server clean [\#18](https://github.com/chef-customers/knife-tidy/pull/18) ([jeremymv2](https://github.com/jeremymv2))
|
197
|
+
|
198
|
+
## [0.2.4](https://github.com/chef-customers/knife-tidy/tree/0.2.4) (2017-09-12)
|
199
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.2.3...0.2.4)
|
200
|
+
|
201
|
+
**Merged pull requests:**
|
202
|
+
|
203
|
+
- disable server clean [\#17](https://github.com/chef-customers/knife-tidy/pull/17) ([jeremymv2](https://github.com/jeremymv2))
|
204
|
+
- bump patch to 0.2.4 [\#16](https://github.com/chef-customers/knife-tidy/pull/16) ([jeremymv2](https://github.com/jeremymv2))
|
205
|
+
- correct any cookbook metadata name issues [\#15](https://github.com/chef-customers/knife-tidy/pull/15) ([jeremymv2](https://github.com/jeremymv2))
|
206
|
+
|
207
|
+
## [0.2.3](https://github.com/chef-customers/knife-tidy/tree/0.2.3) (2017-09-11)
|
208
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.2.2...0.2.3)
|
209
|
+
|
210
|
+
**Merged pull requests:**
|
211
|
+
|
212
|
+
- setting required ruby to \>= 2.0.0 [\#14](https://github.com/chef-customers/knife-tidy/pull/14) ([jeremymv2](https://github.com/jeremymv2))
|
213
|
+
|
214
|
+
## [0.2.2](https://github.com/chef-customers/knife-tidy/tree/0.2.2) (2017-09-11)
|
215
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.2.1...0.2.2)
|
216
|
+
|
217
|
+
**Merged pull requests:**
|
218
|
+
|
219
|
+
- Jeremymv2/fix to i [\#13](https://github.com/chef-customers/knife-tidy/pull/13) ([jeremymv2](https://github.com/jeremymv2))
|
220
|
+
- release 0.2.1 [\#11](https://github.com/chef-customers/knife-tidy/pull/11) ([jeremymv2](https://github.com/jeremymv2))
|
221
|
+
|
222
|
+
## [0.2.1](https://github.com/chef-customers/knife-tidy/tree/0.2.1) (2017-09-01)
|
223
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.2.0...0.2.1)
|
224
|
+
|
225
|
+
**Merged pull requests:**
|
226
|
+
|
227
|
+
- first round of tests [\#10](https://github.com/chef-customers/knife-tidy/pull/10) ([jeremymv2](https://github.com/jeremymv2))
|
228
|
+
- Add environment checking for unused cookbook list [\#9](https://github.com/chef-customers/knife-tidy/pull/9) ([nsdavidson](https://github.com/nsdavidson))
|
229
|
+
- disable [\#8](https://github.com/chef-customers/knife-tidy/pull/8) ([jeremymv2](https://github.com/jeremymv2))
|
230
|
+
- server object deletion [\#7](https://github.com/chef-customers/knife-tidy/pull/7) ([jeremymv2](https://github.com/jeremymv2))
|
231
|
+
- bump version to 0.2.0 [\#6](https://github.com/chef-customers/knife-tidy/pull/6) ([jeremymv2](https://github.com/jeremymv2))
|
232
|
+
|
233
|
+
## [0.2.0](https://github.com/chef-customers/knife-tidy/tree/0.2.0) (2017-08-16)
|
234
|
+
[Full Changelog](https://github.com/chef-customers/knife-tidy/compare/0.1.1...0.2.0)
|
235
|
+
|
236
|
+
**Merged pull requests:**
|
237
|
+
|
238
|
+
- moved all common functions to tidy\_common.rb [\#5](https://github.com/chef-customers/knife-tidy/pull/5) ([jeremymv2](https://github.com/jeremymv2))
|
239
|
+
- Jeremymv2/acl items [\#4](https://github.com/chef-customers/knife-tidy/pull/4) ([jeremymv2](https://github.com/jeremymv2))
|
240
|
+
- updated changelog [\#3](https://github.com/chef-customers/knife-tidy/pull/3) ([jeremymv2](https://github.com/jeremymv2))
|
241
|
+
- bump version to 0.1.1 [\#2](https://github.com/chef-customers/knife-tidy/pull/2) ([jeremymv2](https://github.com/jeremymv2))
|
242
|
+
|
243
|
+
|
22
244
|
|
245
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
23
246
|
|
24
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
# Summary
|
4
4
|
|
5
|
+
NOTE: If you're a first-time or inexperienced knife-tidy user, we recommend you read through this blogpost before proceeding with the rest of this documentation: https://blog.chef.io/2017/10/16/migrating-chef-server-knife-ec-backup-knife-tidy/
|
6
|
+
|
5
7
|
This Chef Knife plugin provides:
|
6
8
|
* Reports on the state of Chef Server objects that can be tidied up
|
7
9
|
* Removal of stale nodes (and associated clients and ACLs) identified by the above Reports
|
@@ -53,6 +53,7 @@ class Chef
|
|
53
53
|
orgs.each do |org|
|
54
54
|
fix_org_object(org)
|
55
55
|
validate_invitations(org)
|
56
|
+
validate_clients_group(org)
|
56
57
|
validate_roles(org)
|
57
58
|
org_acls = Chef::TidyOrgAcls.new(tidy, org)
|
58
59
|
org_acls.validate_acls
|
@@ -391,6 +392,20 @@ class Chef
|
|
391
392
|
end
|
392
393
|
end
|
393
394
|
|
395
|
+
def validate_clients_group(org)
|
396
|
+
ui.stdout.puts "INFO: validating all clients for org #{org} exist in clients group"
|
397
|
+
clients_group_path = ::File.join(tidy.groups_path(org), 'clients.json')
|
398
|
+
existing_group_data = FFI_Yajl::Parser.parse(::File.read(clients_group_path), symbolize_names: false)
|
399
|
+
existing_group_data['clients'] = [] unless existing_group_data.key?('clients')
|
400
|
+
if existing_group_data['clients'].length != tidy.client_names(org).length
|
401
|
+
ui.stdout.puts "REPAIRING: Adding #{(existing_group_data['clients'].length - tidy.client_names(org).length).abs} missing clients into #{org}'s client group file #{clients_group_path}"
|
402
|
+
existing_group_data['clients'] = (existing_group_data['clients'] + tidy.client_names(org)).uniq
|
403
|
+
::File.open(clients_group_path, 'w') do |f|
|
404
|
+
f.write(Chef::JSONCompat.to_json_pretty(existing_group_data))
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
394
409
|
def validate_invitations(org)
|
395
410
|
invite_file = tidy.invitations_path(org)
|
396
411
|
ui.stdout.puts "INFO: validating org #{org} invites in #{invite_file}"
|
data/lib/chef/tidy_common.rb
CHANGED
@@ -32,6 +32,10 @@ class Chef
|
|
32
32
|
::File.expand_path(::File.join(@backup_path, 'organizations', org, 'clients'))
|
33
33
|
end
|
34
34
|
|
35
|
+
def client_names(org)
|
36
|
+
Dir[::File.join(clients_path(org), '*')].map { |dir| ::File.basename(dir, '.json') }
|
37
|
+
end
|
38
|
+
|
35
39
|
def groups_path(org)
|
36
40
|
::File.expand_path(::File.join(@backup_path, 'organizations', org, 'groups'))
|
37
41
|
end
|
data/lib/knife-tidy/version.rb
CHANGED
@@ -1,24 +0,0 @@
|
|
1
|
-
require File.expand_path(File.join(File.dirname(__FILE__), "..", "..", "spec_helper"))
|
2
|
-
require 'chef/knife/tidy_backup_clean'
|
3
|
-
require 'chef/knife'
|
4
|
-
require 'chef/config'
|
5
|
-
require 'stringio'
|
6
|
-
|
7
|
-
class Tester < Chef::Knife
|
8
|
-
end
|
9
|
-
|
10
|
-
describe Chef::Knife::TidyBackupClean do
|
11
|
-
let(:t) { Tester.new }
|
12
|
-
before(:each) do
|
13
|
-
@rest = double('rest')
|
14
|
-
@stderr = StringIO.new
|
15
|
-
allow(t.ui).to receive(:stderr).and_return(@stderr)
|
16
|
-
allow(Chef::ServerAPI).to receive(:new).and_return(@rest)
|
17
|
-
end
|
18
|
-
|
19
|
-
context "completion_message" do
|
20
|
-
it "lets the user know we're Finished" do
|
21
|
-
expect{t.completion_message}.to output("** Finished **\n").to_stdout
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -4,22 +4,22 @@ require 'chef/knife'
|
|
4
4
|
require 'chef/config'
|
5
5
|
require 'stringio'
|
6
6
|
|
7
|
-
class Tester
|
8
|
-
include Chef::Knife::TidyBase
|
7
|
+
class Tester
|
9
8
|
end
|
10
9
|
|
11
10
|
describe Chef::Knife::TidyBase do
|
12
|
-
let(:t) { Tester.new }
|
13
11
|
before(:each) do
|
12
|
+
@t = Tester.new
|
13
|
+
@t.extend(Chef::Knife::TidyBase)
|
14
14
|
@rest = double('rest')
|
15
|
-
@stderr = StringIO.new
|
16
|
-
allow(t.ui).to receive(:stderr).and_return(@stderr)
|
17
15
|
allow(Chef::ServerAPI).to receive(:new).and_return(@rest)
|
16
|
+
@out = StringIO.new("** Finished **\n")
|
17
|
+
allow(@t).to receive(:ui).and_return(@out)
|
18
18
|
end
|
19
19
|
|
20
|
-
|
20
|
+
describe "#completion_message" do
|
21
21
|
it "lets the user know we're Finished" do
|
22
|
-
expect
|
22
|
+
expect(@t.completion_message).to eq(@out)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
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: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.7.
|
148
|
+
rubygems_version: 2.7.6
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: Report on stale Chef Server nodes and cookbooks and clean up data integrity
|