Method: Amazon#alter_instances!

Defined in:
lib/cluster/infrastructures/amazon.rb

#alter_instances!(*iss) ⇒ Object

[View source]

230
231
232
233
234
235
236
237
238
239
240
241
242
# File 'lib/cluster/infrastructures/amazon.rb', line 230

def alter_instances!(*iss)
  list = iss.empty? ? instances : iss

  for ins in list.flatten
    yield ins if block_given?
    attrs = ins.attributes
    remove = attrs.keys.select {|k| attrs[k].empty? and attrs.delete(k) }
    unless remove.empty?
      sdb.delete_attributes domain, ins.aws_id, remove
    end
    sdb.put_attributes domain, ins.aws_id, ins.attributes, :replace
  end
end