diff options
author | tyler-ball <tyleraball@gmail.com> | 2014-09-17 14:54:35 -0700 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2014-09-29 08:31:08 -0700 |
commit | 75a90633b5015f91425644670d839377837fb8d3 (patch) | |
tree | db329123e8080b0e148ead474eb22713488e8a71 /lib/chef/knife/data_bag_secret_options.rb | |
parent | 9d431178e1c9d98c6caed74366e9b9abd9d2404c (diff) | |
download | chef-75a90633b5015f91425644670d839377837fb8d3.tar.gz |
Fixing bad method definition
Diffstat (limited to 'lib/chef/knife/data_bag_secret_options.rb')
-rw-r--r-- | lib/chef/knife/data_bag_secret_options.rb | 50 |
1 files changed, 29 insertions, 21 deletions
diff --git a/lib/chef/knife/data_bag_secret_options.rb b/lib/chef/knife/data_bag_secret_options.rb index 238d09667c..766006089e 100644 --- a/lib/chef/knife/data_bag_secret_options.rb +++ b/lib/chef/knife/data_bag_secret_options.rb @@ -54,28 +54,12 @@ class Chef :default => false end - ## - # Determine if the user has specified an appropriate secret for encrypting data bag items. - # @returns boolean - def encryption_secret_provided?(need_encrypt_flag = true) - validate_secrets - - return true if has_cl_secret? || has_cl_secret_file? + def encryption_secret_provided? + base_encryption_secret_provided? + end - if need_encrypt_flag - if config[:encrypt] - unless knife_config[:secret] || knife_config[:secret_file] - ui.fatal("No secret or secret_file specified in config, unable to encrypt item.") - exit(1) - end - return true - end - return false - elsif knife_config[:secret] || knife_config[:secret_file] - # Certain situations (show and bootstrap) don't need a --encrypt flag to use the config file secret - return true - end - return false + def encryption_secret_provided_ignore_encrypt_flag? + base_encryption_secret_provided?(false) end def read_secret @@ -109,6 +93,30 @@ class Chef private + ## + # Determine if the user has specified an appropriate secret for encrypting data bag items. + # @returns boolean + def base_encryption_secret_provided?(need_encrypt_flag = true) + validate_secrets + + return true if has_cl_secret? || has_cl_secret_file? + + if need_encrypt_flag + if config[:encrypt] + unless knife_config[:secret] || knife_config[:secret_file] + ui.fatal("No secret or secret_file specified in config, unable to encrypt item.") + exit(1) + end + return true + end + return false + elsif knife_config[:secret] || knife_config[:secret_file] + # Certain situations (show and bootstrap) don't need a --encrypt flag to use the config file secret + return true + end + return false + end + def has_cl_secret? Chef::Config[:knife].has_key?(:cl_secret) end |