diff options
-rw-r--r-- | lib/chef/encrypted_data_bag_item/assertions.rb | 2 | ||||
-rw-r--r-- | lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb | 2 | ||||
-rw-r--r-- | lib/chef/resource/script.rb | 1 | ||||
-rw-r--r-- | spec/functional/resource/cron_spec.rb | 8 | ||||
-rw-r--r-- | spec/functional/resource/rpm_spec.rb | 5 | ||||
-rw-r--r-- | spec/spec_helper.rb | 1 | ||||
-rw-r--r-- | spec/support/chef_helpers.rb | 1 | ||||
-rw-r--r-- | spec/support/platform_helpers.rb | 4 | ||||
-rw-r--r-- | spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/encrypted_data_bag_item_spec.rb | 4 |
10 files changed, 22 insertions, 8 deletions
diff --git a/lib/chef/encrypted_data_bag_item/assertions.rb b/lib/chef/encrypted_data_bag_item/assertions.rb index e9acebbd29..0f9416e7b6 100644 --- a/lib/chef/encrypted_data_bag_item/assertions.rb +++ b/lib/chef/encrypted_data_bag_item/assertions.rb @@ -45,7 +45,7 @@ class Chef::EncryptedDataBagItem def assert_aead_requirements_met!(algorithm) unless OpenSSL::Cipher.method_defined?(:auth_data=) - raise EncryptedDataBagRequirementsFailure, "The used Encrypted Data Bags version requires Ruby >= 1.9" + raise EncryptedDataBagRequirementsFailure, "The used Encrypted Data Bags version requires Ruby >= 2.0" end unless OpenSSL::Cipher.ciphers.include?(algorithm) raise EncryptedDataBagRequirementsFailure, "The used Encrypted Data Bags version requires an OpenSSL version with \"#{algorithm}\" algorithm support" diff --git a/lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb b/lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb index 3567925844..9a54396174 100644 --- a/lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb +++ b/lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb @@ -25,7 +25,7 @@ class Chef::EncryptedDataBagItem def assert_requirements_met! unless OpenSSL::Cipher.method_defined?(:auth_data=) - raise EncryptedDataBagRequirementsFailure, "The used Encrypted Data Bags version requires Ruby >= 1.9" + raise EncryptedDataBagRequirementsFailure, "The used Encrypted Data Bags version requires Ruby >= 2.0" end unless OpenSSL::Cipher.ciphers.include?(algorithm) raise EncryptedDataBagRequirementsFailure, "The used Encrypted Data Bags version requires an OpenSSL version with \"#{algorithm}\" algorithm support" diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index 8cc9c6f0c5..ff7d23f075 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -32,6 +32,7 @@ class Chef @code = nil @interpreter = nil @flags = nil + @default_guard_interpreter = :default end def code(arg=nil) diff --git a/spec/functional/resource/cron_spec.rb b/spec/functional/resource/cron_spec.rb index 0a19fae0ed..287b5a1391 100644 --- a/spec/functional/resource/cron_spec.rb +++ b/spec/functional/resource/cron_spec.rb @@ -17,6 +17,7 @@ # limitations under the License. # +require 'spec_helper' require 'functional/resource/base' require 'chef/mixin/shell_out' @@ -55,7 +56,12 @@ describe Chef::Resource::Cron, :requires_root, :unix_only do let(:new_resource) do new_resource = Chef::Resource::Cron.new("Chef functional test cron", run_context) new_resource.user 'root' - new_resource.minute '@hourly' + # @hourly is not supported on solaris + if ohai[:platform] == "solaris" || ohai[:platform] == "solaris2" + new_resource.minute "0 * * * *" + else + new_resource.minute '@hourly' + end new_resource.hour '' new_resource.day '' new_resource.month '' diff --git a/spec/functional/resource/rpm_spec.rb b/spec/functional/resource/rpm_spec.rb index 7825377c6b..2e452d7e2e 100644 --- a/spec/functional/resource/rpm_spec.rb +++ b/spec/functional/resource/rpm_spec.rb @@ -16,6 +16,7 @@ # limitations under the License. # +require 'spec_helper' require 'functional/resource/base' require 'chef/mixin/shell_out' @@ -60,12 +61,12 @@ describe Chef::Resource::RpmPackage, :requires_root, :external => exclude_test d @pkg_name = "dummy" @pkg_version = "1-0" @pkg_path = "/tmp/dummy-1-0.aix6.1.noarch.rpm" - FileUtils.cp 'spec/functional/assets/dummy-1-0.aix6.1.noarch.rpm' , @pkg_path + FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'dummy-1-0.aix6.1.noarch.rpm') , @pkg_path) when "centos", "redhat", "suse" @pkg_name = "mytest" @pkg_version = "1.0-1" @pkg_path = "/tmp/mytest-1.0-1.noarch.rpm" - FileUtils.cp 'spec/functional/assets/mytest-1.0-1.noarch.rpm' , @pkg_path + FileUtils.cp(File.join(CHEF_SPEC_ASSETS, 'mytest-1.0-1.noarch.rpm') , @pkg_path) end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index e282a88100..d29215f5fe 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -133,6 +133,7 @@ RSpec.configure do |config| config.filter_run_excluding :ruby_gte_20_and_openssl_gte_101 => true unless (ruby_gte_20? && openssl_gte_101?) config.filter_run_excluding :openssl_lt_101 => true unless openssl_lt_101? config.filter_run_excluding :ruby_lt_20 => true unless ruby_lt_20? + config.filter_run_excluding :aes_256_gcm_only => true unless aes_256_gcm? running_platform_arch = `uname -m`.strip diff --git a/spec/support/chef_helpers.rb b/spec/support/chef_helpers.rb index f31355f50a..237543748c 100644 --- a/spec/support/chef_helpers.rb +++ b/spec/support/chef_helpers.rb @@ -14,6 +14,7 @@ # limitations under the License. # CHEF_SPEC_DATA = File.expand_path(File.dirname(__FILE__) + "/../data/") +CHEF_SPEC_ASSETS = File.expand_path(File.dirname(__FILE__) + "/../functional/assets/") CHEF_SPEC_BACKUP_PATH = File.join(Dir.tmpdir, 'test-backup-path') Chef::Config[:log_level] = :fatal diff --git a/spec/support/platform_helpers.rb b/spec/support/platform_helpers.rb index f8cad6de7f..8d17af3993 100644 --- a/spec/support/platform_helpers.rb +++ b/spec/support/platform_helpers.rb @@ -165,3 +165,7 @@ end def openssl_lt_101? !openssl_gte_101? end + +def aes_256_gcm? + OpenSSL::Cipher.ciphers.include?("aes-256-gcm") +end diff --git a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb index 1da5efb36e..1e2b2a85e8 100644 --- a/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +++ b/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb @@ -83,7 +83,7 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do end end - context "when encryption version is 3", :ruby_20_only do + context "when encryption version is 3", :aes_256_gcm_only, :ruby_20_only do include_examples "encryption detected" do let(:version) { 3 } let(:encryptor) { Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor } diff --git a/spec/unit/encrypted_data_bag_item_spec.rb b/spec/unit/encrypted_data_bag_item_spec.rb index 9335889ef3..499fabdcf9 100644 --- a/spec/unit/encrypted_data_bag_item_spec.rb +++ b/spec/unit/encrypted_data_bag_item_spec.rb @@ -97,7 +97,7 @@ describe Chef::EncryptedDataBagItem::Encryptor do Chef::Config[:data_bag_encrypt_version] = 3 end - context "on supported platforms", :ruby_gte_20_and_openssl_gte_101 do + context "on supported platforms", :aes_256_gcm_only, :ruby_20_only do it "creates a version 3 encryptor" do encryptor.should be_a_instance_of(Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor) @@ -182,7 +182,7 @@ describe Chef::EncryptedDataBagItem::Decryptor do context "when decrypting a version 3 (JSON+aes-256-gcm+random iv+auth tag) encrypted value" do - context "on supported platforms", :ruby_gte_20_and_openssl_gte_101 do + context "on supported platforms", :aes_256_gcm_only, :ruby_20_only do let(:encrypted_value) do Chef::EncryptedDataBagItem::Encryptor::Version3Encryptor.new(plaintext_data, encryption_key).for_encrypted_item |