knife-tidy 2.1.0 → 2.1.2
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 +11 -10
- data/lib/chef/knife/tidy_notify.rb +8 -8
- data/lib/chef/knife/tidy_server_clean.rb +1 -1
- data/lib/chef/knife/tidy_server_report.rb +2 -2
- data/lib/chef/tidy_acls.rb +3 -3
- data/lib/chef/tidy_common.rb +2 -2
- data/lib/chef/tidy_substitutions.rb +3 -3
- data/lib/knife-tidy/version.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: ebbadbfe49e6402c189f63e8e0290eeb93d409f89f4220ef9ad6bdc96b0b455f
|
4
|
+
data.tar.gz: ee7f3392eac804aeec3490c33c1e02d9d22d1bd038f3a1eb8222fd9d9c660dd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e78b266e0482121cd3d551a9d683cd79b85aae16bb31d53260c2c73a7ceae1080052cd582957b55a23099c7799ed8312e0a5fcde1b920640497af04872894ab7
|
7
|
+
data.tar.gz: b1e97749b9ed73fe512b76a45291541b070eb730ded2f86dc4de1f355258e319017338e183c53a0dd2b4671f98a513ba4a5ca69053e6dc834359f396e15257ee
|
@@ -10,9 +10,9 @@ class Chef
|
|
10
10
|
require "chef/run_list"
|
11
11
|
require_relative "../tidy_substitutions"
|
12
12
|
require_relative "../tidy_acls"
|
13
|
-
require "ffi_yajl"
|
14
|
-
require "fileutils"
|
15
|
-
require "securerandom"
|
13
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
14
|
+
require "fileutils" unless defined?(FileUtils)
|
15
|
+
require "securerandom" unless defined?(SecureRandom)
|
16
16
|
end
|
17
17
|
|
18
18
|
banner "knife tidy backup clean (options)"
|
@@ -25,7 +25,7 @@ class Chef
|
|
25
25
|
|
26
26
|
option :gsub_file,
|
27
27
|
long: "--gsub-file path/to/gsub/file",
|
28
|
-
description: "The path to the file used for substitutions. If non-
|
28
|
+
description: "The path to the file used for substitutions. If non-existent, a boiler plate one will be created."
|
29
29
|
|
30
30
|
option :gen_gsub,
|
31
31
|
long: "--gen-gsub",
|
@@ -167,7 +167,7 @@ class Chef
|
|
167
167
|
ret = cl.load!
|
168
168
|
if ret.nil?
|
169
169
|
action_needed("ACTION NEEDED: Something's wrong with the #{cookbook} cookbook in org #{org} - cannot load it! Moving to cookbooks.broken folder.")
|
170
|
-
|
170
|
+
broken_cookbooks_add(org, cookbook)
|
171
171
|
end
|
172
172
|
end
|
173
173
|
rescue LoadError, Exceptions::MetadataNotValid => e
|
@@ -175,7 +175,7 @@ class Chef
|
|
175
175
|
exit 1
|
176
176
|
end
|
177
177
|
|
178
|
-
def
|
178
|
+
def broken_cookbooks_add(org, cookbook_path)
|
179
179
|
broken_path = ::File.join(tidy.org_path(org), "cookbooks.broken")
|
180
180
|
FileUtils.mkdir(broken_path) unless ::File.directory?(broken_path)
|
181
181
|
FileUtils.mv(cookbook_path, broken_path, verbose: true, force: true)
|
@@ -297,7 +297,7 @@ class Chef
|
|
297
297
|
|
298
298
|
def substitutions_file
|
299
299
|
sub_file_path = ::File.expand_path(config[:gsub_file])
|
300
|
-
ui.error "
|
300
|
+
ui.error "Substitutions file #{sub_file_path} does not exist!" unless ::File.exist?(sub_file_path)
|
301
301
|
@substitutions_file ||= sub_file_path
|
302
302
|
end
|
303
303
|
|
@@ -397,9 +397,10 @@ class Chef
|
|
397
397
|
if existing_group_data["clients"].length != tidy.client_names(org).length
|
398
398
|
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}"
|
399
399
|
existing_group_data["clients"] = (existing_group_data["clients"] + tidy.client_names(org)).uniq
|
400
|
-
|
401
|
-
|
402
|
-
|
400
|
+
end
|
401
|
+
existing_group_data["clients"] = existing_group_data["clients"].sort
|
402
|
+
::File.open(clients_group_path, "w") do |f|
|
403
|
+
f.write(Chef::JSONCompat.to_json_pretty(existing_group_data))
|
403
404
|
end
|
404
405
|
end
|
405
406
|
|
@@ -4,7 +4,7 @@ class Chef
|
|
4
4
|
class Knife
|
5
5
|
class TidyNotify < Knife
|
6
6
|
deps do
|
7
|
-
require "ffi_yajl"
|
7
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
8
8
|
require "net/smtp"
|
9
9
|
end
|
10
10
|
|
@@ -14,39 +14,39 @@ class Chef
|
|
14
14
|
short: "-s SERVER_NAME",
|
15
15
|
long: "--smtp_server SERVER_NAME",
|
16
16
|
default: "localhost",
|
17
|
-
description: "SMTP Server to be used for
|
17
|
+
description: "SMTP Server to be used for emailing reports to organization admins (defaults to localhost)"
|
18
18
|
|
19
19
|
option :smtp_port,
|
20
20
|
short: "-p SMTP_PORT",
|
21
21
|
long: "--smtp_port SMTP_PORT",
|
22
22
|
default: 25,
|
23
|
-
description: "SMTP port to be used for
|
23
|
+
description: "SMTP port to be used for emailing reports to organization admins (defaults to 25)"
|
24
24
|
|
25
25
|
option :smtp_helo,
|
26
26
|
short: "-h SMTP_HELO",
|
27
27
|
long: "--smtp_helo SMTP_HELO",
|
28
28
|
default: "localhost",
|
29
|
-
description: "SMTP HELO to be used for
|
29
|
+
description: "SMTP HELO to be used for emailing reports to organization admins (defaults to localhost)"
|
30
30
|
|
31
31
|
option :smtp_username,
|
32
32
|
short: "-u SMTP_USERNAME",
|
33
33
|
long: "--smtp_username SMTP_USERNAME",
|
34
|
-
description: "SMTP Username to be used for
|
34
|
+
description: "SMTP Username to be used for emailing reports to organization admins"
|
35
35
|
|
36
36
|
option :smtp_password,
|
37
37
|
long: "--smtp_password SMTP_PASSWORD",
|
38
|
-
description: "SMTP Password to be used for
|
38
|
+
description: "SMTP Password to be used for emailing reports to organization admins"
|
39
39
|
|
40
40
|
option :smtp_from,
|
41
41
|
long: "--smtp_from SMTP_FROM",
|
42
|
-
description: "SMTP From address to be used for
|
42
|
+
description: "SMTP From address to be used for emailing reports to organization admins"
|
43
43
|
|
44
44
|
option :smtp_use_tls,
|
45
45
|
long: "--smtp_use_tls",
|
46
46
|
short: "-t",
|
47
47
|
default: false,
|
48
48
|
boolean: true | false,
|
49
|
-
description: "Whether TLS should be used for
|
49
|
+
description: "Whether TLS should be used for emailing reports to organization admins (defaults to false if omitted)"
|
50
50
|
|
51
51
|
include Knife::TidyBase
|
52
52
|
|
@@ -7,7 +7,7 @@ class Chef
|
|
7
7
|
include Knife::TidyBase
|
8
8
|
|
9
9
|
deps do
|
10
|
-
require "ffi_yajl"
|
10
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
11
11
|
end
|
12
12
|
|
13
13
|
banner "knife tidy server report (options)"
|
@@ -108,7 +108,7 @@ class Chef
|
|
108
108
|
action_needed(pre_12_3_message, server_warnings_file_path)
|
109
109
|
end
|
110
110
|
if unconverged_recent_nodes.length > 0
|
111
|
-
unconverged_recent_message = "#{unconverged_recent_nodes.length} nodes have been created in the last hour that have yet to converge in organization #{org}. These nodes WILL NOT be factored in the stale cookbook
|
111
|
+
unconverged_recent_message = "#{unconverged_recent_nodes.length} nodes have been created in the last hour that have yet to converge in organization #{org}. These nodes WILL NOT be factored in the stale cookbook versions report. Continuing with the server cleanup will delete cookbooks in-use by these nodes."
|
112
112
|
ui.warn(unconverged_recent_message)
|
113
113
|
action_needed(unconverged_recent_message, server_warnings_file_path)
|
114
114
|
end
|
data/lib/chef/tidy_acls.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
require "ffi_yajl"
|
2
|
-
require "fileutils"
|
1
|
+
require "ffi_yajl" unless defined?(FFI_Yajl)
|
2
|
+
require "fileutils" unless defined?(FileUtils)
|
3
3
|
require "chef/log"
|
4
4
|
|
5
5
|
class Chef
|
@@ -111,7 +111,7 @@ class Chef
|
|
111
111
|
|
112
112
|
def add_client_to_org(actor)
|
113
113
|
# TODO
|
114
|
-
@tidy.ui.stdout.puts "ACTION NEEDED: Client referenced in acl non-
|
114
|
+
@tidy.ui.stdout.puts "ACTION NEEDED: Client referenced in acl non-existent: #{actor}"
|
115
115
|
end
|
116
116
|
|
117
117
|
def add_actor_to_members(actor)
|
data/lib/chef/tidy_common.rb
CHANGED
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.1.
|
4
|
+
version: 2.1.2
|
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-08-21 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
|