Class: Serverspec::Type::OctopusDeployEnvironment
- Inherits:
-
Base
- Object
- Base
- Serverspec::Type::OctopusDeployEnvironment
- Defined in:
- lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb
Instance Method Summary collapse
- #allow_dynamic_infrastructure? ⇒ Boolean
- #exists? ⇒ Boolean
- #in_space(space_name) ⇒ Object
-
#initialize(*url_and_api_key, environment_name) ⇒ OctopusDeployEnvironment
constructor
A new instance of OctopusDeployEnvironment.
- #use_guided_failure? ⇒ Boolean
Constructor Details
#initialize(*url_and_api_key, environment_name) ⇒ OctopusDeployEnvironment
Returns a new instance of OctopusDeployEnvironment.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb', line 15 def initialize(*url_and_api_key, environment_name) serverUrl, apiKey = get_octopus_creds(url_and_api_key) @environment_name = environment_name @name = "Octopus Deploy Environment #{environment_name}" @runner = Specinfra::Runner @serverUrl = serverUrl @apiKey = apiKey if environment_name.nil? raise "'environment_name' was not provided. Unable to connect to Octopus server to validate configuration." end @serverSupportsSpaces = check_supports_spaces(serverUrl) end |
Instance Method Details
#allow_dynamic_infrastructure? ⇒ Boolean
42 43 44 45 46 |
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb', line 42 def allow_dynamic_infrastructure? load_resource_if_nil false if @environment.nil? @environment['AllowDynamicInfrastructure'] == true end |
#exists? ⇒ Boolean
31 32 33 34 |
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb', line 31 def exists? load_resource_if_nil (!@environment.nil?) && (@environment != []) end |
#in_space(space_name) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb', line 48 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 @environment_name.nil? raise "'environment_name' was not provided. Unable to connect to Octopus server to validate configuration." end if(@spaceId.nil?) raise "unable to resolve space '#{@spaceId}'" end self end |
#use_guided_failure? ⇒ Boolean
36 37 38 39 40 |
# File 'lib/octopus_serverspec_extensions/type/octopus_deploy_environment.rb', line 36 def use_guided_failure? load_resource_if_nil false if @environment.nil? @environment['UseGuidedFailure'] == true end |