optimize deployments load.
This commit is contained in:
Родитель
750aea3dd9
Коммит
49ea97e9da
|
@ -21,18 +21,31 @@ class Azure
|
|||
def initialize(connection)
|
||||
@connection=connection
|
||||
end
|
||||
def all
|
||||
# force_load should be true when there is something in local cache and we want to reload
|
||||
# first call is always load.
|
||||
def load(force_load = false)
|
||||
if not @deploys || force_load
|
||||
@deploys = begin
|
||||
deploys = Array.new
|
||||
hosts = @connection.hosts.all
|
||||
hosts.each do |host|
|
||||
deploy = Deploy.new(@connection)
|
||||
deploy.retrieve(host.name)
|
||||
unless deploy.name == nil
|
||||
if deploy.name
|
||||
host.add_deploy(deploy)
|
||||
deploys << deploy
|
||||
end
|
||||
end
|
||||
deploys
|
||||
end
|
||||
end
|
||||
@deploys
|
||||
end
|
||||
|
||||
def all
|
||||
self.load
|
||||
end
|
||||
|
||||
def find(hostedservicename)
|
||||
deployName = nil
|
||||
self.all.each do |deploy|
|
||||
|
|
|
@ -80,8 +80,11 @@ class Azure
|
|||
attr_accessor :connection, :name, :url, :label
|
||||
attr_accessor :dateCreated, :description, :location
|
||||
attr_accessor :dateModified, :status
|
||||
attr_accessor :deploys
|
||||
|
||||
def initialize(connection)
|
||||
@connection = connection
|
||||
@deploys = []
|
||||
end
|
||||
def parse(serviceXML)
|
||||
@name = xml_content(serviceXML, 'ServiceName')
|
||||
|
@ -108,5 +111,10 @@ class Azure
|
|||
def details
|
||||
response = @connection.query_azure('hostedservices/' + @name + '?embed-detail=true')
|
||||
end
|
||||
|
||||
# Deploys within this hostedservice
|
||||
def add_deploy(deploy)
|
||||
@deploys << deploy
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче