class Serverspec::Type::OctopusDeployWorkerPool

Public Class Methods

new(*url_and_api_key, worker_pool_name) click to toggle source
# File lib/octopus_serverspec_extensions/type/octopus_deploy_worker_pool.rb, line 13
def initialize(*url_and_api_key, worker_pool_name)
  serverUrl = get_octopus_url(url_and_api_key[0])
  apiKey = get_octopus_api_key(url_and_api_key[1])

  @worker_pool_name = worker_pool_name

  @name = "Octopus Deploy Worker Pool #{worker_pool_name}"
  @runner = Specinfra::Runner
  @serverUrl = serverUrl
  @apiKey = apiKey

  if (serverUrl.nil?)
    raise "'serverUrl' was not provided. Unable to connect to Octopus server to validate configuration."
  end
  if (apiKey.nil?)
    raise "'apiKey' was not provided. Unable to connect to Octopus server to validate configuration."
  end
  if (worker_pool_name.nil?)
    raise "'worker_pool_name' was not provided. Unable to connect to Octopus server to validate configuration."
  end

  @worker_pool = get_worker_pool_via_api(serverUrl, apiKey, worker_pool_name)
end

Public Instance Methods

exists?() click to toggle source
# File lib/octopus_serverspec_extensions/type/octopus_deploy_worker_pool.rb, line 47
def exists?
  (!@worker_pool.nil?) && (@worker_pool != [])
end
in_space(space_name) click to toggle source
# File lib/octopus_serverspec_extensions/type/octopus_deploy_worker_pool.rb, line 37
def in_space(space_name)
  # allows us to tag .in_space() onto the end of the resource. as in
  # describe octopus_worker_pool("account name").in_space("MyNewSpace") do
  @spaceId = get_space_id?(space_name)
  if @worker_pool_name.nil?
    raise "'worker_pool_name' was not provided. Unable to connect to Octopus server to validate configuration."
  end
  self
end