mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[aws|compute] raise an ArgumentError if image_id is nil, otherwise an ugly InternalError is returned from AWS.
This commit is contained in:
parent
a842b3699e
commit
48b2f590aa
2 changed files with 10 additions and 0 deletions
|
@ -20,6 +20,8 @@ module Fog
|
|||
# {Amazon API Reference}[http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-ModifyImageAttribute.html]
|
||||
#
|
||||
def modify_image_attribute(image_id, attributes)
|
||||
raise ArgumentError.new("image_id is required") unless image_id
|
||||
|
||||
params = {}
|
||||
params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.Group', attributes['Add.Group'] || []))
|
||||
params.merge!(Fog::AWS.indexed_param('LaunchPermission.Add.%d.UserId', attributes['Add.UserId'] || []))
|
||||
|
|
|
@ -65,4 +65,12 @@ Shindo.tests('Fog::Compute[:aws] | image requests', ['aws']) do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
tests('failure') do
|
||||
pending if Fog.mocking?
|
||||
|
||||
tests("#modify_image_attribute(nil, { 'Add.Group' => ['all'] })").raises(ArgumentError) do
|
||||
Fog::Compute[:aws].modify_image_attribute(nil, { 'Add.Group' => ['all'] }).body
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue