1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

[compute|aws] add support for saving assigned tags at server creation time

closes #366
This commit is contained in:
geemus 2011-08-08 12:17:14 -05:00
parent 65719c6549
commit d82a1e13bb
2 changed files with 21 additions and 1 deletions

View file

@ -168,6 +168,15 @@ module Fog
data = connection.run_instances(image_id, 1, 1, options)
merge_attributes(data.body['instancesSet'].first)
for key, value in self.tags
connection.tags.create(
:key => key,
:resource_id => self.identity,
:value => value
)
end
true
end

View file

@ -6,7 +6,6 @@ Shindo.tests("Fog::Compute[:aws] | monitor", ['aws']) do
responds_to(association)
end
tests('new instance') do
test('#monitor = true') do
@ -44,4 +43,16 @@ Shindo.tests("Fog::Compute[:aws] | monitor", ['aws']) do
end
@instance.destroy
tests('tags') do
@instance = Fog::Compute[:aws].servers.create(:tags => {'key' => 'value'})
tests('@instance.reload.tags').returns({'key' => 'value'}) do
@instance.reload.tags
end
Fog::Compute[:aws].tags.all('resource-id' => @instance.identity).each {|tag| tag.destroy}
@instance.destroy
end
end