[Docker] fixed attributes aliases

This commit is contained in:
Amos Benari 2014-02-27 12:40:39 +02:00
parent 92dfcd5f6a
commit aedaf730e8
3 changed files with 15 additions and 11 deletions

View File

@ -8,11 +8,15 @@ module Fog
attr_accessor :info
attribute :repotags
attribute :repo_tags
attribute :created
attribute :size
attribute :virtual_size
def name
repo_tags.empty? ? id : repo_tags.first
end
def ready?
!(status =~ /down/i)
end

View File

@ -12,16 +12,16 @@ module Fog
attribute :name
attribute :created
attribute :network_settings_ipaddress, :aliases => 'ipaddress'
attribute :network_settings_bridge, :aliases => 'bridge'
attribute :ipaddress, :aliases => 'network_settings_ipaddress'
attribute :bridge, :aliases => 'network_settings_bridge'
attribute :state_running
attribute :state_pid
attribute :config_cpu_shares, :aliases => 'cpus'
attribute :config_memory, :aliases => 'memory'
attribute :config_hostname, :aliases => 'hostname'
attribute :cores, :aliases => 'config_cpu_shares'
attribute :memory, :aliases => 'config_memory'
attribute :hostname, :aliases => 'config_hostname'
attribute :host
attribute :image
attribute :config_exposed_ports, :aliases => 'exposed_ports'
attribute :exposed_ports, :aliases => 'config_exposed_ports'
attribute :volumes
#raw = {"ID"=>"2ce79789656e4f7474624be6496dc6d988899af30d556574389a19aade2f9650",
@ -86,7 +86,7 @@ module Fog
end
def start(options = {})
service.container_action(:id =>id, :action => :start)
service.container_action(:id =>id, :action => :start!)
reload
end
@ -97,7 +97,7 @@ module Fog
end
def restart(options = {})
service.container_action(:id =>id, :action => :restart)
service.container_action(:id =>id, :action => :restart!)
reload
end

View File

@ -10,7 +10,7 @@ Shindo.tests('Fog::Compute[:fogdocker] | image model', ['fogdocker']) do
tests('have attributes') do
model_attribute_hash = image.attributes
attributes = [ :id,
:repotags,
:repo_tags,
:created,
:size
]
@ -20,7 +20,7 @@ Shindo.tests('Fog::Compute[:fogdocker] | image model', ['fogdocker']) do
end
end
tests("The attributes hash should have key") do
(attributes-[:repotags]).each do |attribute|
(attributes-[:repo_tags]).each do |attribute|
test("#{attribute}") { model_attribute_hash.has_key? attribute }
end
end