Revision 9a9ec5b1
Added by Daniel Lobato Garcia over 8 years ago
app/models/compute_resources/foreman/model/ec2.rb | ||
---|---|---|
class EC2 < ComputeResource
|
||
has_one :key_pair, :foreign_key => :compute_resource_id, :dependent => :destroy
|
||
|
||
delegate :subnets, :to => :client
|
||
delegate :flavors, :subnets, :to => :client
|
||
validates :user, :password, :presence => true
|
||
|
||
after_create :setup_key_pair
|
||
... | ... | |
@zones ||= client.describe_availability_zones.body["availabilityZoneInfo"].map { |r| r["zoneName"] if r["regionName"] == region }.compact
|
||
end
|
||
|
||
def flavors
|
||
client.flavors
|
||
end
|
||
|
||
def test_connection(options = {})
|
||
super
|
||
errors[:user].empty? and errors[:password].empty? and regions
|
Also available in: Unified diff
Refs #3809 - Enable Rails delegate cop