lib/bolt/bolt_option_parser.rb in bolt-2.42.0 vs lib/bolt/bolt_option_parser.rb in bolt-2.44.0

- old
+ new

@@ -758,17 +758,14 @@ bolt task show Display documentation for the canary task bolt task show canary HELP - attr_reader :deprecations - def initialize(options) super() @options = options - @deprecations = [] separator "\nINVENTORY OPTIONS" define('-t', '--targets TARGETS', 'Identifies the targets of command.', 'Enter a comma-separated list of target URIs or group names.', @@ -794,13 +791,15 @@ define('--noop', 'See what changes Bolt will make without actually executing the changes') do |_| @options[:noop] = true end define('--description DESCRIPTION', 'Deprecated. Description to use for the job') do |description| - msg = "Command line option '--description' is deprecated, and will be "\ + Bolt::Logger.deprecate( + "description_cli_option", + "Command line option '--description' is deprecated, and will be "\ "removed in Bolt 3.0." - @deprecations << { type: 'Using --description', msg: msg } + ) @options[:description] = description end define('--params PARAMETERS', "Parameters to a task or plan as json, a json file '@<file>', or on stdin '-'") do |params| @options[:task_options] = parse_params(params) @@ -879,26 +878,30 @@ end end define('--boltdir PATH', 'Deprecated. Specify what project to load config from (default:', 'autodiscovered from current working dir)') do |path| - msg = "Command line option '--boltdir' is deprecated, use '--project' instead." - @deprecations << { type: 'Using --boltdir', msg: msg } + Bolt::Logger.deprecate( + "boltdir_cli_option", + "Command line option '--boltdir' is deprecated, use '--project' instead." + ) @options[:boltdir] = path end define('--project PATH', 'Path to load the Bolt project from (default: autodiscovered from current dir)') do |path| @options[:project] = path end define('--configfile PATH', 'Deprecated. Specify where to load config from (default:', '~/.puppetlabs/bolt/bolt.yaml). Directory containing bolt.yaml will be', 'used as the project directory.') do |path| - msg = "Command line option '--configfile' is deprecated, and " \ + Bolt::Logger.deprecate( + "configfile_cli_option", + "Command line option '--configfile' is deprecated, and " \ "will be removed in Bolt 3.0. Use '--project' and provide the "\ "directory path instead." - @deprecations << { type: 'Using --configfile', msg: msg } + ) @options[:configfile] = path end define('--hiera-config PATH', 'Specify where to load Hiera config from (default: ~/.puppetlabs/bolt/hiera.yaml)') do |path| @options[:'hiera-config'] = File.expand_path(path) @@ -913,14 +916,16 @@ define('--puppetfile PATH', 'Deprecated. Specify a Puppetfile to use when installing modules.', ' (default: ~/.puppetlabs/bolt/Puppetfile)', 'Modules are installed in the current project.') do |path| command = Bolt::Util.powershell? ? 'Update-BoltProject' : 'bolt project migrate' - msg = "Command line option '--puppetfile' is deprecated, and will be removed "\ + Bolt::Logger.deprecate( + "puppetfile_cli_option", + "Command line option '--puppetfile' is deprecated, and will be removed "\ "in Bolt 3.0. You can migrate to using the new module management "\ "workflow using '#{command}'." - @deprecations << { type: 'Using --puppetfile', msg: msg } + ) @options[:puppetfile_path] = File.expand_path(path) end define('--[no-]save-rerun', 'Whether to update the rerun file after this command.') do |save| @options[:'save-rerun'] = save end @@ -1015,11 +1020,13 @@ end define('--debug', 'Display debug logging') do |_| @options[:debug] = true # We don't actually set '--log-level debug' here, but once the options are evaluated by # the config class the end result is the same. - msg = "Command line option '--debug' is deprecated, set '--log-level debug' instead." - @deprecations << { type: 'Using --debug instead of --log-level debug', msg: msg } + Bolt::Logger.deprecate( + "debug_cli_option", + "Command line option '--debug' is deprecated, set '--log-level debug' instead." + ) end define('--log-level LEVEL', "Set the log level for the console. Available options are", "trace, debug, info, warn, error, fatal, any.") do |level| @options[:log] = { 'console' => { 'level' => level } }