knife-tidy 2.0.12 → 2.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/conf/substitutions.json.example +10 -0
- data/lib/chef/knife/tidy_server_report.rb +18 -0
- data/lib/knife-tidy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7aaf34102e27291f03892bfb4eddb450aaed46c5e615818e48a59c174c91e42
|
4
|
+
data.tar.gz: f482bbfb1182b581532ef643900c6f4814dc800ff42e02ff0a29b8936faed77b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5192215cbd8341aef601e71bf6c42bb2eb5d19f652570734ac192151941d7b954da8d0fe5c504ea67b599772d09ea12da77d6d782f54e2c967c6c12fc9cef0d
|
7
|
+
data.tar.gz: 75b37b5663f0558791ad1a52b5281d84197e1def8ed2c15103896165a781b4a07f1ac4556f5d266e35fb662d76218e6be0ccf413d569e0b7b776075e5a5aca27
|
@@ -17,6 +17,11 @@ class Chef
|
|
17
17
|
default: 30,
|
18
18
|
description: "Maximum number of days since last checkin before node is considered stale (default: 30)"
|
19
19
|
|
20
|
+
option :keep_versions,
|
21
|
+
long: "--keep-versions MIN",
|
22
|
+
default: 0,
|
23
|
+
description: "Keep a minimum of this many versions of each cookbook (default: 0)"
|
24
|
+
|
20
25
|
def run
|
21
26
|
ensure_reports_dir!
|
22
27
|
FileUtils.rm_f(server_warnings_file_path)
|
@@ -32,6 +37,7 @@ class Chef
|
|
32
37
|
|
33
38
|
stale_orgs = []
|
34
39
|
node_threshold = config[:node_threshold].to_i
|
40
|
+
keep_versions = config[:keep_versions].to_i
|
35
41
|
|
36
42
|
orgs.each do |org|
|
37
43
|
pre_12_3_nodes = []
|
@@ -76,6 +82,9 @@ class Chef
|
|
76
82
|
end
|
77
83
|
end
|
78
84
|
|
85
|
+
used_cookbooks = keep_cookbook_versions(cb_list, keep_versions)
|
86
|
+
|
87
|
+
Chef::Log.debug("Used cookbook list before checking environments: #{used_cookbooks}")
|
79
88
|
pins = environment_constraints(org)
|
80
89
|
used_cookbooks = check_environment_pins(used_cookbooks, pins, cb_list)
|
81
90
|
|
@@ -153,6 +162,15 @@ class Chef
|
|
153
162
|
cb_list
|
154
163
|
end
|
155
164
|
|
165
|
+
def keep_cookbook_versions(cb_list, min)
|
166
|
+
retain = {}
|
167
|
+
cb_list.each do |name, versions|
|
168
|
+
keep = versions.sort { |a, b| Gem::Version.new(a) <=> Gem::Version.new(b) }.last(min)
|
169
|
+
retain[name] = keep
|
170
|
+
end
|
171
|
+
retain
|
172
|
+
end
|
173
|
+
|
156
174
|
def cookbook_count(cb_list)
|
157
175
|
cb_count_list = {}
|
158
176
|
cb_list.each do |name, versions|
|
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: 2.0.
|
4
|
+
version: 2.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Miller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Report on stale Chef Server nodes and cookbooks and clean up data integrity
|
14
14
|
issues in a knife-ec-backup object based backup
|
@@ -19,6 +19,7 @@ extensions: []
|
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
21
|
- LICENSE
|
22
|
+
- conf/substitutions.json.example
|
22
23
|
- lib/chef/knife/tidy_backup_clean.rb
|
23
24
|
- lib/chef/knife/tidy_base.rb
|
24
25
|
- lib/chef/knife/tidy_notify.rb
|