knife-tidy 2.1.6 → 2.3.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/lib/chef/knife/tidy_backup_clean.rb +10 -14
- data/lib/chef/knife/tidy_notify.rb +7 -9
- data/lib/chef/tidy_common.rb +3 -3
- data/lib/knife-tidy/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c2702f9782813c2c218f78232a3d174459c457d55c5384a52b10d23a0ac28bb
|
4
|
+
data.tar.gz: d0212907d1f8d6b8287e76f12ecac60bcecfb7dd9ca614a48a06b6d3322f0dca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f31036894ee89b00964d0a6c94297935f6c8824414c90e09005d8ac9ab45399d56b430ca4f1b941cbeadd9b1b177d76963e2f85c81d2a288e3d611301479fb9
|
7
|
+
data.tar.gz: 7e93f0b7404db7453bac17ebd260a6e31e9ff72a1425353ad6331dc3bcbc3728226bc4ad9587d6c346b0036d36e416dc1f147105fa5e5dbf60eb1bd7b9a9ebed
|
@@ -130,10 +130,10 @@ class Chef
|
|
130
130
|
|
131
131
|
def add_cookbook_name_to_metadata(cookbook_name, rb_path)
|
132
132
|
ui.stdout.puts "REPAIRING: Correcting `name` in #{rb_path}"
|
133
|
-
content =
|
133
|
+
content = File.readlines(rb_path)
|
134
134
|
new_content = content.reject { |line| line =~ /^name\s+/ }
|
135
135
|
name_field = "name '#{cookbook_name}'\n"
|
136
|
-
|
136
|
+
File.write(rb_path, name_field + new_content.join(""))
|
137
137
|
end
|
138
138
|
|
139
139
|
def fix_cookbook_names(org)
|
@@ -354,23 +354,19 @@ class Chef
|
|
354
354
|
rl = Chef::RunList.new
|
355
355
|
new_role["run_list"] = []
|
356
356
|
the_role["run_list"].each do |item|
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
ui.stdout.puts "REPAIRING: Invalid Recipe Item: #{item} in run_list from #{role_path}"
|
362
|
-
end
|
357
|
+
rl << item
|
358
|
+
new_role["run_list"].push(item)
|
359
|
+
rescue ArgumentError
|
360
|
+
ui.stdout.puts "REPAIRING: Invalid Recipe Item: #{item} in run_list from #{role_path}"
|
363
361
|
end
|
364
362
|
if the_role.key?("env_run_lists")
|
365
363
|
the_role["env_run_lists"].each_pair do |key, value|
|
366
364
|
new_role["env_run_lists"][key] = []
|
367
365
|
value.each do |item|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
ui.stdout.puts "REPAIRING: Invalid Recipe Item: #{item} in env_run_lists #{key} from #{role_path}"
|
373
|
-
end
|
366
|
+
rl << item
|
367
|
+
new_role["env_run_lists"][key].push(item)
|
368
|
+
rescue ArgumentError
|
369
|
+
ui.stdout.puts "REPAIRING: Invalid Recipe Item: #{item} in env_run_lists #{key} from #{role_path}"
|
374
370
|
end
|
375
371
|
end
|
376
372
|
end
|
@@ -84,15 +84,13 @@ class Chef
|
|
84
84
|
ui.info("Fetching report data for organization #{org}")
|
85
85
|
reports[org] = {}
|
86
86
|
report_file_suffixes.each do |report|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
reports[org][report] = {}
|
95
|
-
end
|
87
|
+
file_name = "#{reports_dir}/#{org}#{report}"
|
88
|
+
ui.info(" Parsing file #{file_name}")
|
89
|
+
json_string = File.read(file_name)
|
90
|
+
reports[org][report] = tidy.json_file_to_hash(json_string, symbolize_names: false)
|
91
|
+
rescue Errno::ENOENT
|
92
|
+
ui.info(" Skipping file #{file_name} - not found for organization #{org}")
|
93
|
+
reports[org][report] = {}
|
96
94
|
end
|
97
95
|
|
98
96
|
# Fetch a list of admin users for the current organization
|
data/lib/chef/tidy_common.rb
CHANGED
@@ -196,9 +196,9 @@ class Chef
|
|
196
196
|
dirs = path.split(File::SEPARATOR)
|
197
197
|
|
198
198
|
until dirs.empty?
|
199
|
-
version_match = dirs[-1]
|
200
|
-
if dirs[-2] == "cookbooks" && version_match
|
201
|
-
return version_match
|
199
|
+
version_match = dirs[-1][/\b\d{1,3}\.\d{1,3}\.\d{1,3}\b/]
|
200
|
+
if dirs.length >= 2 && dirs[-2] == "cookbooks" && version_match
|
201
|
+
return version_match
|
202
202
|
else
|
203
203
|
dirs.pop
|
204
204
|
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: 2.
|
4
|
+
version: 2.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Report on stale Chef Infra Server nodes and cookbooks and clean up data
|
14
14
|
integrity issues in a knife-ec-backup object based backup
|
@@ -42,14 +42,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
42
42
|
requirements:
|
43
43
|
- - ">="
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: 2.
|
45
|
+
version: 2.7.0
|
46
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
48
|
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
52
|
+
rubygems_version: 3.3.27
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Report on stale Chef Infra Server nodes and cookbooks and clean up data integrity
|