summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2019-10-06 00:53:10 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2019-10-06 00:53:10 +0530
commit245a8ee7cd23a39956ffa36190cb766aca632ad8 (patch)
treec2d86cbd8084fe4b428ad4e30bd6f05ed7a9df6d
parentbdddb78e4856871e8c8d6c67046834c47ec03855 (diff)
downloadchef-245a8ee7cd23a39956ffa36190cb766aca632ad8.tar.gz
Add deprecation warning if secret option -s is passed
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
-rw-r--r--lib/chef/knife/data_bag_secret_options.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb
index 43f60494ba..d94aa4aa50 100644
--- a/lib/chef/knife/data_bag_secret_options.rb
+++ b/lib/chef/knife/data_bag_secret_options.rb
@@ -35,6 +35,7 @@ class Chef
def self.included(base)
base.option :secret,
+ short: "-s 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
@@ -79,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]