From eb99011251f92abfb554aaee423909a1fc1ae0e2 Mon Sep 17 00:00:00 2001 From: Eugene Howe Date: Mon, 10 Oct 2016 16:34:26 -0400 Subject: [PATCH] fix describe mount targets --- lib/fog/aws/efs.rb | 2 ++ lib/fog/aws/requests/efs/describe_mount_targets.rb | 2 +- tests/requests/efs/file_system_tests.rb | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/fog/aws/efs.rb b/lib/fog/aws/efs.rb index 9832da0bc..ba38903a1 100644 --- a/lib/fog/aws/efs.rb +++ b/lib/fog/aws/efs.rb @@ -159,6 +159,8 @@ module Fog raise Fog::AWS::EFS::IncorrectFileSystemLifeCycleState.slurp(error, match[:message]) elsif match[:code] == 'FileSystemInUse' raise Fog::AWS::EFS::FileSystemInUse.slurp(error, match[:message]) + elsif match[:code] == 'MountTargetNotFound' + raise Fog::AWS::EFS::NotFound.slurp(error, match[:message]) end raise case match[:message] when /invalid ((file system)|(mount target)|(security group)) id/i diff --git a/lib/fog/aws/requests/efs/describe_mount_targets.rb b/lib/fog/aws/requests/efs/describe_mount_targets.rb index 71dc16813..0a1d65a01 100644 --- a/lib/fog/aws/requests/efs/describe_mount_targets.rb +++ b/lib/fog/aws/requests/efs/describe_mount_targets.rb @@ -39,7 +39,7 @@ module Fog if mount_target = self.data[:mount_targets][id] [mount_target] else - raise Fog::AWS::EFS::NotFound.new("invalid file system ID: #{id}") + raise Fog::AWS::EFS::NotFound.new("Mount target does not exist.") end elsif file_system_id = options[:file_system_id] self.data[:mount_targets].values.select { |mt| mt["FileSystemId"] == file_system_id } diff --git a/tests/requests/efs/file_system_tests.rb b/tests/requests/efs/file_system_tests.rb index dc01ff0df..049df9648 100644 --- a/tests/requests/efs/file_system_tests.rb +++ b/tests/requests/efs/file_system_tests.rb @@ -105,6 +105,10 @@ Shindo.tests('AWS::EFS | file systems', ['aws', 'efs']) do Fog::AWS[:efs].describe_mount_targets(:id => mount_target_id).body end + raises(Fog::AWS::EFS::NotFound, 'Mount target does not exist.') do + Fog::AWS[:efs].describe_mount_targets(:id => "foobar") + end + raises(Fog::AWS::EFS::Error, 'file system ID or mount target ID must be specified') do Fog::AWS[:efs].describe_mount_targets end