diff --git a/lib/fog/aws/models/compute/volume.rb b/lib/fog/aws/models/compute/volume.rb index b4817c2ee..0d894b98b 100644 --- a/lib/fog/aws/models/compute/volume.rb +++ b/lib/fog/aws/models/compute/volume.rb @@ -117,6 +117,10 @@ module Fog end end + def server=(_) + raise NoMethodError, 'use Fog::Compute::AWS::Volume#attach(server, device)' + end + private def attachmentSet=(new_attachment_set) diff --git a/tests/models/compute/volume_tests.rb b/tests/models/compute/volume_tests.rb index 87ca6ed71..37b30cfbf 100644 --- a/tests/models/compute/volume_tests.rb +++ b/tests/models/compute/volume_tests.rb @@ -25,6 +25,10 @@ Shindo.tests('Fog::Compute[:aws] | volume', ['aws']) do @instance.server.nil? end + tests('#server=').raises(NoMethodError, 'use Fog::Compute::AWS::Volume#attach(server, device)') do + @instance.server = @server + end + tests('#attach(server, device)').succeeds do @instance.attach(@server, '/dev/sdz1') @instance.server == @server