summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-10-15 09:11:12 -0700
committerGitHub <noreply@github.com>2019-10-15 09:11:12 -0700
commitc40da3e1689050ec7317e9d46b00bb3291a283cd (patch)
treeb88f4b4ab7a9566eb654bbcfd08b62ac56115934
parent05a3d205d74a0c9968af1e36a95632e4e772f2b9 (diff)
parent245a8ee7cd23a39956ffa36190cb766aca632ad8 (diff)
downloadchef-c40da3e1689050ec7317e9d46b00bb3291a283cd.tar.gz
Merge pull request #8909 from MsysTechnologiesllc/VSingh/remove-secret-short-option
[knife] Deprecate data bag secret (-s) short option due to conflict with --server-url option
-rw-r--r--lib/chef/knife/data_bag_secret_options.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb
index 4b4cb8a7e1..d94aa4aa50 100644
--- a/lib/chef/knife/data_bag_secret_options.rb
+++ b/lib/chef/knife/data_bag_secret_options.rb
@@ -36,7 +36,7 @@ class Chef
def self.included(base)
base.option :secret,
short: "-s SECRET",
- long: "--secret ",
+ long: "--secret SECRET",
description: "The secret key to use to encrypt data bag item values. Can also be defaulted in your config with the key 'secret'.",
# Need to store value from command line in separate variable - knife#merge_configs populates same keys
# on config object from
@@ -80,9 +80,16 @@ class Chef
end
def validate_secrets
- if has_cl_secret? && has_cl_secret_file?
- ui.fatal("Please specify only one of --secret, --secret-file")
- exit(1)
+ if has_cl_secret?
+ if opt_parser.default_argv.include?("-s")
+ ui.warn("Secret short option -s is deprecated and will remove in the future. Please use --secret instead.
+")
+ end
+
+ if has_cl_secret_file?
+ ui.fatal("Please specify only one of --secret, --secret-file")
+ exit(1)
+ end
end
if knife_config[:secret] && knife_config[:secret_file]