summaryrefslogtreecommitdiff
path: root/lib/chef/application
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-09-21 15:04:09 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2019-03-11 12:20:20 -0700
commitdf23dbbda7d4eb621804f004ff85181d83a11641 (patch)
treedc4ac3d354e5b9eb3229ed9be56d5447cc9a1d85 /lib/chef/application
parentb870d8c578a6424e405ec2083d5f47d331f09d14 (diff)
downloadchef-df23dbbda7d4eb621804f004ff85181d83a11641.tar.gz
WIP: Remove audit mode from chef-client
This just gives us a line count to the change and perhaps a starting point for when we do this in Chef 15 Signed-off-by: Tim Smith <tsmith@chef.io> Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/application')
-rw-r--r--lib/chef/application/client.rb23
-rw-r--r--lib/chef/application/exit_code.rb10
-rw-r--r--lib/chef/application/solo.rb3
3 files changed, 1 insertions, 35 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 0e5584ded3..cdeb376f96 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -272,11 +272,6 @@ class Chef::Application::Client < Chef::Application
boolean: true
end
- option :audit_mode,
- long: "--audit-mode MODE",
- description: "Enable audit-mode with `enabled`. Disable audit-mode with `disabled`. Skip converge and only perform audits with `audit-only`",
- proc: lambda { |mo| mo.tr("-", "_").to_sym }
-
option :minimal_ohai,
long: "--minimal-ohai",
description: "Only run the bare minimum ohai plugins chef needs to function",
@@ -374,13 +369,6 @@ class Chef::Application::Client < Chef::Application
config_fetcher = Chef::ConfigFetcher.new(Chef::Config[:json_attribs])
@chef_client_json = config_fetcher.fetch_json
end
-
- if mode = config[:audit_mode] || Chef::Config[:audit_mode]
- expected_modes = [:enabled, :disabled, :audit_only]
- unless expected_modes.include?(mode)
- Chef::Application.fatal!(unrecognized_audit_mode(mode))
- end
- end
end
def load_config_file
@@ -521,17 +509,6 @@ class Chef::Application::Client < Chef::Application
"\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options."
end
- def audit_mode_settings_explanation
- "\n* To enable audit mode after converge, use command line option `--audit-mode enabled` or set `audit_mode :enabled` in your config file." +
- "\n* To disable audit mode, use command line option `--audit-mode disabled` or set `audit_mode :disabled` in your config file." +
- "\n* To only run audit mode, use command line option `--audit-mode audit-only` or set `audit_mode :audit_only` in your config file." +
- "\nAudit mode is disabled by default."
- end
-
- def unrecognized_audit_mode(mode)
- "Unrecognized setting #{mode} for audit mode." + audit_mode_settings_explanation
- end
-
def fetch_recipe_tarball(url, path)
Chef::Log.trace("Download recipes tarball from #{url} to #{path}")
if File.exist?(url)
diff --git a/lib/chef/application/exit_code.rb b/lib/chef/application/exit_code.rb
index c87592f06b..6c9618fcb4 100644
--- a/lib/chef/application/exit_code.rb
+++ b/lib/chef/application/exit_code.rb
@@ -34,7 +34,7 @@ class Chef
REBOOT_SCHEDULED: 35,
REBOOT_NEEDED: 37,
REBOOT_FAILED: 41,
- AUDIT_MODE_FAILURE: 42,
+ # 42 was used by audit mode and should not be reused
CLIENT_UPGRADED: 213,
}.freeze
@@ -78,8 +78,6 @@ class Chef
VALID_RFC_062_EXIT_CODES[:REBOOT_NEEDED]
elsif reboot_failed?(exception)
VALID_RFC_062_EXIT_CODES[:REBOOT_FAILED]
- elsif audit_failure?(exception)
- VALID_RFC_062_EXIT_CODES[:AUDIT_MODE_FAILURE]
elsif client_upgraded?(exception)
VALID_RFC_062_EXIT_CODES[:CLIENT_UPGRADED]
else
@@ -105,12 +103,6 @@ class Chef
end
end
- def audit_failure?(exception)
- resolve_exception_array(exception).any? do |e|
- e.is_a? Chef::Exceptions::AuditError
- end
- end
-
def client_upgraded?(exception)
resolve_exception_array(exception).any? do |e|
e.is_a? Chef::Exceptions::ClientUpgraded
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 763d52226a..148e7720a5 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -288,9 +288,6 @@ class Chef::Application::Solo < Chef::Application
config_fetcher = Chef::ConfigFetcher.new(Chef::Config[:json_attribs])
@chef_client_json = config_fetcher.fetch_json
end
-
- # Disable auditing for solo
- Chef::Config[:audit_mode] = :disabled
end
def setup_application