From cf8e39a2988c451726edec0e31aefa4c9c4fb1d1 Mon Sep 17 00:00:00 2001 From: Michelle Noorali Date: Mon, 3 Aug 2015 14:00:31 -0700 Subject: [PATCH] raise InvalidParameterCombination error * availability_zone cannot be specified when multi_az in create_db_instance request mock --- lib/fog/aws/rds.rb | 1 + lib/fog/aws/requests/rds/create_db_instance.rb | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/fog/aws/rds.rb b/lib/fog/aws/rds.rb index af4b2dd2a..029fcd0ed 100644 --- a/lib/fog/aws/rds.rb +++ b/lib/fog/aws/rds.rb @@ -4,6 +4,7 @@ module Fog extend Fog::AWS::CredentialFetcher::ServiceMethods class IdentifierTaken < Fog::Errors::Error; end + class InvalidParameterCombination < Fog::Errors::Error; end class AuthorizationAlreadyExists < Fog::Errors::Error; end diff --git a/lib/fog/aws/requests/rds/create_db_instance.rb b/lib/fog/aws/requests/rds/create_db_instance.rb index 4da4b60fa..c881aa55a 100644 --- a/lib/fog/aws/requests/rds/create_db_instance.rb +++ b/lib/fog/aws/requests/rds/create_db_instance.rb @@ -78,6 +78,10 @@ module Fog end end + if !!options["MultiAZ"] && !!options["AvailabilityZone"] + raise Fog::AWS::RDS::InvalidParameterCombination.new('Requesting a specific availability zone is not valid for Multi-AZ instances.') + end + data = { "AllocatedStorage" => options["AllocatedStorage"], "AutoMinorVersionUpgrade" => options["AutoMinorVersionUpgrade"].nil? ? true : options["AutoMinorVersionUpgrade"], @@ -98,7 +102,7 @@ module Fog "Iops" => options["Iops"], "LicenseModel" => "general-public-license", "MasterUsername" => options["MasterUsername"], - "MultiAZ" => !!options['MultiAZ'], + "MultiAZ" => !!options["MultiAZ"], "PendingModifiedValues" => { "MasterUserPassword" => "****" }, # This clears when is available "PreferredBackupWindow" => options["PreferredBackupWindow"] || "08:00-08:30", "PreferredMaintenanceWindow" => options["PreferredMaintenanceWindow"] || "mon:04:30-mon:05:00",