diff options
author | tyler-ball <tyleraball@gmail.com> | 2014-09-08 08:52:11 -0700 |
---|---|---|
committer | tyler-ball <tyleraball@gmail.com> | 2014-09-29 08:31:08 -0700 |
commit | 8b1866e11e8ab41543cde22151c08365f2d4e3da (patch) | |
tree | 40df3be3ecb987955ae28833f271b9e4f41ac229 /lib | |
parent | 40c2f92437579044284f9b4cc433ccf4f1d9d391 (diff) | |
download | chef-8b1866e11e8ab41543cde22151c08365f2d4e3da.tar.gz |
Updating tests for encrypted data bag create - found some missing coverage
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/knife/data_bag_create.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/knife/data_bag_create.rb b/lib/chef/knife/data_bag_create.rb index afd5832ead..d54d047db4 100644 --- a/lib/chef/knife/data_bag_create.rb +++ b/lib/chef/knife/data_bag_create.rb @@ -80,16 +80,22 @@ class Chef exit(1) end + # TODO is there validation on the config schema? If so, this validation should go there + if has_secret? && has_secret_file? + ui.fatal("Please specify only one of 'secret' or 'secret_file' in your config") + exit(1) + end + return true if config[:secret] || config[:secret_file] if config[:encrypt] unless has_secret? || has_secret_file? ui.fatal("No secret or secret_file specified in config, unable to encrypt item.") exit(1) + else + return true end - return true - else - return false end + return false end def run |