Class: Serverspec::Type::OctopusDeployTeam

Inherits:
Base
  • Object
show all
Defined in:
lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb

Instance Method Summary collapse

Constructor Details

#initialize(*url_and_api_key, team_name) ⇒ OctopusDeployTeam

Returns a new instance of OctopusDeployTeam.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb', line 14

def initialize(*url_and_api_key, team_name)
  serverUrl,apiKey = get_octopus_creds(url_and_api_key)

  @team_name = team_name

  @name = "Octopus Deploy User Account #{serverUrl}"
  @runner = Specinfra::Runner
  @serverUrl = serverUrl
  @apiKey = apiKey

  if team_name.nil?
    raise "'team_name' was not provided"
  end
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


29
30
31
32
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb', line 29

def exists?
  load_resource_if_nil
  @team != nil?
end

#in_space(space_name) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb', line 34

def in_space(space_name)
  # allows us to tag .in_space() onto the end of the resource. as in
  # describe octopus_account("account name").in_space("MyNewSpace") do
  @spaceId = get_space_id?(space_name)
  if @team_name.nil?
    raise "'team_name' was not provided. Unable to connect to Octopus server to validate configuration."
  end
  self
end

#load_resource_if_nilObject



44
45
46
47
48
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_team.rb', line 44

def load_resource_if_nil
  if @team.nil?
    @team = get_team_via_api(@serverUrl, @apiKey, @team_name)
  end
end