module SettingsHelper

Public Instance Methods

configure_capybara(ops_manager_url) click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 124
def configure_capybara(ops_manager_url)
  Capybara.configure do |c|
    c.default_driver = :webkit
  end

  begin
    Capybara::Webkit.configure do |c|
      c.allow_url(ops_manager_url)
      c.ignore_ssl_errors
    end
  rescue
    # Capybara says, "All configuration must take place before the driver starts"
  end

  page.current_window.resize_to(1024, 3000) # avoid overlapping footer spec failures
end
delete_timeout() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 34
def delete_timeout
  Integer(ENV.fetch('DELETE_TIMEOUT'))
end
environment_name() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 116
def environment_name
  ENV.fetch('ENVIRONMENT_NAME')
end
errand_names() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 38
def errand_names
  JSON.parse(ENV.fetch('ERRAND_NAMES'))
end
export_destination_path() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 14
def export_destination_path
  ENV.fetch('EXPORT_DESTINATION')
end
fetch_environment_settings() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 120
def fetch_environment_settings
  Opsmgr::Environments.for(environment_name).settings
end
import_file_path() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 18
def import_file_path
  ENV.fetch('IMPORT_FILE')
end
install_timeout() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 30
def install_timeout
  ENV.fetch('INSTALL_TIMEOUT').to_i
end
om_version() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 26
def om_version
  ENV.fetch('OM_VERSION')
end
ops_manager_api_driver() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 70
def ops_manager_api_driver
  fail 'Include OpsManagerUiDrivers::PageHelpers' unless respond_to? :fetch_environment_settings

  env_settings = fetch_environment_settings
  case om_version
  when '1.4'
    api_1_4(
      host: env_settings['ops_manager']['url'],
      username: env_settings['ops_manager']['username'],
      password: env_settings['ops_manager']['password'],
    )
  when '1.5'
    api_1_5(
      host: env_settings['ops_manager']['url'],
      username: env_settings['ops_manager']['username'],
      password: env_settings['ops_manager']['password'],
    )
  when '1.6'
    api_1_6(
      host: env_settings['ops_manager']['url'],
      username: env_settings['ops_manager']['username'],
      password: env_settings['ops_manager']['password'],
    )
  when '1.7'
    api_1_7(
      host: env_settings['ops_manager']['url'],
      username: env_settings['ops_manager']['username'],
      password: env_settings['ops_manager']['password'],
    )
  when '1.8'
    api_1_8(
      host: env_settings['ops_manager']['url'],
      username: env_settings['ops_manager']['username'],
      password: env_settings['ops_manager']['password'],
    )
  when '1.9'
    api_1_9(
      host: env_settings['ops_manager']['url'],
      username: env_settings['ops_manager']['username'],
      password: env_settings['ops_manager']['password'],
    )
  else
    fail "Unsupported Ops Manager Version #{om_version.inspect}"
  end
end
ops_manager_driver() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 47
def ops_manager_driver
  fail 'Include OpsManagerUiDrivers::PageHelpers' unless respond_to? :fetch_environment_settings

  configure_capybara(fetch_environment_settings['ops_manager']['url'])
  ops_manager_url = fetch_environment_settings['ops_manager']['url']
  case om_version
  when '1.4'
    om_1_4(ops_manager_url)
  when '1.5'
    om_1_5(ops_manager_url)
  when '1.6'
    om_1_6(ops_manager_url)
  when '1.7'
    om_1_7(ops_manager_url)
  when '1.8'
    om_1_8(ops_manager_url)
  when '1.9'
    om_1_9(ops_manager_url)
  else
    fail "Unsupported Ops Manager Version #{om_version.inspect}"
  end
end
poll_interval() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 42
def poll_interval
  ENV.fetch('POLL_INTERVAL').to_i
end
product_name() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 10
def product_name
  ENV.fetch('PRODUCT_NAME')
end
product_path() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 6
def product_path
  ENV.fetch('PRODUCT_PATH')
end
stemcell_file_path() click to toggle source
# File lib/opsmgr/ui_helpers/settings_helper.rb, line 22
def stemcell_file_path
  ENV.fetch('STEMCELL_FILE')
end