class Prof::Environment::PcfDrinks

Attributes

page[R]
tempest_config[R]

Public Class Methods

new(tempest_config) click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 25
def initialize(tempest_config)
  @tempest_config = tempest_config
end

Public Instance Methods

bosh_director() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 45
def bosh_director
  @bosh_director ||= Hula::BoshDirector.new(
    target_url:  bosh_director_url,
    username:    bosh_credentials.fetch('identity'),
    password:    bosh_credentials.fetch('password')
  )
end
cloud_foundry() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 33
def cloud_foundry
  @cloud_foundry ||= Prof::CloudFoundry.new(
    domain:   cloud_foundry_domain,
    username: ops_manager.cf_admin_credentials.username,
    password: ops_manager.cf_admin_credentials.password
  )
end
cloud_foundry_domain() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 41
def cloud_foundry_domain
  tempest_config.fetch('cloudfoundry').fetch('domain')
end
cloud_foundry_uaa() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 62
def cloud_foundry_uaa
  @cloud_foundry_uaa ||= UAAClient.new(
    cloud_foundry_domain,
    cloud_controller_client_credentials.identity,
    cloud_controller_client_credentials.password
  )
end
ops_manager() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 29
def ops_manager
  @ops_manager ||= OpsManager.new(environment_name: ENV.fetch('TEMPEST_ENVIRONMENT'), version: ENV.fetch('OM_VERSION'))
end
ssh_gateway() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 53
def ssh_gateway
  SshGateway.new(
    gateway_host:     ssh_gateway_config.fetch('host'),
    gateway_username: ssh_gateway_config.fetch('username'),
    gateway_password: ssh_gateway_config['password'],
    ssh_key:          ssh_gateway_config['ssh_key']
  )
end

Private Instance Methods

bosh_credentials() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 117
def bosh_credentials
  ops_manager.bosh_credentials
end
bosh_director_url() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 112
def bosh_director_url
  return URI("https://127.0.0.1:#{forwarded_bosh_port}").to_s if !tempest_config['proxy'].nil?
  return director.hostname
end
cloud_controller_client_credentials() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 78
def cloud_controller_client_credentials
  @cloud_controller_client_credentials ||= ops_manager.cc_client_credentials
end
default_capybara_session() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 74
def default_capybara_session
  Capybara::Session.new(Capybara.default_driver)
end
director() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 90
def director
  director = ops_manager.vms_for_job_type('director').first

  if director.nil?
    raise NoDirectorVm, "No director VM found for #{ops_manager.url}"
  else
    director
  end
end
forwarded_bosh_port() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 82
def forwarded_bosh_port
  @forwarded_bosh_port ||=
    ssh_gateway.with_port_forwarded_to(
      director.hostname,
      25555
    )
end
ops_manager_config() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 104
def ops_manager_config
  tempest_config.fetch('tempest')
end
ops_manager_hostname() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 100
def ops_manager_hostname
  URI.parse(ops_manager_config.fetch('url')).hostname
end
ssh_gateway_config() click to toggle source
# File lib/prof/environment/pcf_drinks.rb, line 108
def ssh_gateway_config
  tempest_config.fetch('proxy')
end