From d68ecc918ec7e3c48b92b39341d7649812a19768 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 15 Jul 2019 21:56:55 -0700 Subject: consolidate some options in the base class most of these are options that apply to either chef-client -z or to chef-solo without legacy mode, so they are justifiably common options (that are handled by the trampolining into the Client code from Solo right now. the --legacy-mode switch is solo-specific (although we should wire it up for chef-client eventually once all the code is merged). old-reporting and skip-cookbook-sync only make sense for actual chef-client runs so are marked as such in the help text Signed-off-by: Lamont Granquist --- lib/chef/application/base.rb | 53 ++++++++++++++++++++++++++++++++++++++++++ lib/chef/application/client.rb | 48 -------------------------------------- lib/chef/application/solo.rb | 5 ---- 3 files changed, 53 insertions(+), 53 deletions(-) (limited to 'lib/chef/application') diff --git a/lib/chef/application/base.rb b/lib/chef/application/base.rb index e0519367e0..e55324272a 100644 --- a/lib/chef/application/base.rb +++ b/lib/chef/application/base.rb @@ -233,6 +233,59 @@ class Chef::Application::Base < Chef::Application description: "Enable FIPS mode.", boolean: true + option :solo_legacy_mode, + long: "--legacy-mode", + description: "Run in legacy mode.", + boolean: true + + option :chef_server_url, + short: "-S CHEFSERVERURL", + long: "--server CHEFSERVERURL", + description: "The #{Chef::Dist::SERVER_PRODUCT} URL.", + proc: nil + + option :validation_key, + short: "-K KEY_FILE", + long: "--validation_key KEY_FILE", + description: "Set the validation key file location, used for registering new clients.", + proc: nil + + option :client_key, + short: "-k KEY_FILE", + long: "--client_key KEY_FILE", + description: "Set the client key file location.", + proc: nil + + option :enable_reporting, + short: "-R", + long: "--enable-reporting", + description: "(#{Chef::Dist::CLIENT} only) reporting data collection for runs.", + boolean: true + + option :local_mode, + short: "-z", + long: "--local-mode", + description: "Point at local repository.", + boolean: true + + option :chef_zero_host, + long: "--chef-zero-host HOST", + description: "Host to start #{Chef::Dist::ZERO} on." + + option :chef_zero_port, + long: "--chef-zero-port PORT", + description: "Port (or port range) to start #{Chef::Dist::ZERO} on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works." + + option :listen, + long: "--[no-]listen", + description: "Whether a local mode (-z) server binds to a port.", + boolean: false + + option :skip_cookbook_sync, + long: "--[no-]skip-cookbook-sync", + description: "(#{Chef::Dist::CLIENT} only) Use cached cookbooks without overwriting local differences from the #{Chef::Dist::SERVER_PRODUCT}.", + boolean: false + IMMEDIATE_RUN_SIGNAL = "1".freeze RECONFIGURE_SIGNAL = "H".freeze diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index 7e33777151..e36c990c65 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -48,24 +48,6 @@ class Chef::Application::Client < Chef::Application::Base description: "Set the PID file location, for the #{Chef::Dist::CLIENT} daemon process. Defaults to /tmp/chef-client.pid.", proc: nil - option :chef_server_url, - short: "-S CHEFSERVERURL", - long: "--server CHEFSERVERURL", - description: "The #{Chef::Dist::SERVER_PRODUCT} URL.", - proc: nil - - option :validation_key, - short: "-K KEY_FILE", - long: "--validation_key KEY_FILE", - description: "Set the validation key file location, used for registering new clients.", - proc: nil - - option :client_key, - short: "-k KEY_FILE", - long: "--client_key KEY_FILE", - description: "Set the client key file location.", - proc: nil - option :named_run_list, short: "-n NAMED_RUN_LIST", long: "--named-run-list NAMED_RUN_LIST", @@ -86,36 +68,6 @@ class Chef::Application::Client < Chef::Application::Base long: "--recipe-url=RECIPE_URL", description: "Pull down a remote archive of recipes and unpack it to the cookbook cache. Only used in local mode." - option :enable_reporting, - short: "-R", - long: "--enable-reporting", - description: "Enable reporting data collection for #{Chef::Dist::PRODUCT} runs.", - boolean: true - - option :local_mode, - short: "-z", - long: "--local-mode", - description: "Point #{Chef::Dist::CLIENT} at local repository.", - boolean: true - - option :chef_zero_host, - long: "--chef-zero-host HOST", - description: "Host to start #{Chef::Dist::ZERO} on." - - option :chef_zero_port, - long: "--chef-zero-port PORT", - description: "Port (or port range) to start #{Chef::Dist::ZERO} on. Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works." - - option :listen, - long: "--[no-]listen", - description: "Wt dhether a local mode (-z) server binds to a port.", - boolean: false - - option :skip_cookbook_sync, - long: "--[no-]skip-cookbook-sync", - description: "Use cached cookbooks without overwriting local differences from the #{Chef::Dist::SERVER_PRODUCT}.", - boolean: false - # Reconfigure the chef client # Re-open the JSON attributes and load them into the node def reconfigure diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index 1d3e817dfc..bce95c2841 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -49,11 +49,6 @@ class Chef::Application::Solo < Chef::Application::Base long: "--recipe-url RECIPE_URL", description: "Pull down a remote gzipped tarball of recipes and untar it to the cookbook cache." - option :solo_legacy_mode, - long: "--legacy-mode", - description: "Run #{Chef::Dist::SOLO} in legacy mode.", - boolean: true - # Get this party started def run(enforce_license: false) setup_signal_handlers -- cgit v1.2.1