Module: SettingsHelper
- Defined in:
- lib/opsmgr/ui_helpers/config_helper.rb
Instance Method Summary collapse
- #configure_capybara(ops_manager_url) ⇒ Object
- #delete_timeout ⇒ Object
- #environment_name ⇒ Object
- #errand_names ⇒ Object
- #export_destination_path ⇒ Object
- #fetch_environment_settings ⇒ Object
- #import_file_path ⇒ Object
- #install_timeout ⇒ Object
- #om_version ⇒ Object
- #ops_manager_api_driver ⇒ Object
- #ops_manager_driver ⇒ Object
- #product_name ⇒ Object
- #product_path ⇒ Object
- #stemcell_file_path ⇒ Object
Instance Method Details
#configure_capybara(ops_manager_url) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 105 def (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, 2600) # avoid overlapping footer spec failures end |
#delete_timeout ⇒ Object
41 42 43 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 41 def delete_timeout Integer(ENV.fetch('DELETE_TIMEOUT')) end |
#environment_name ⇒ Object
97 98 99 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 97 def environment_name ENV.fetch('ENVIRONMENT_NAME') end |
#errand_names ⇒ Object
45 46 47 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 45 def errand_names JSON.parse(ENV.fetch('ERRAND_NAMES')) end |
#export_destination_path ⇒ Object
21 22 23 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 21 def export_destination_path ENV.fetch('EXPORT_DESTINATION') end |
#fetch_environment_settings ⇒ Object
101 102 103 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 101 def fetch_environment_settings Opsmgr::Environments.for(environment_name).settings end |
#import_file_path ⇒ Object
25 26 27 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 25 def import_file_path ENV.fetch('IMPORT_FILE') end |
#install_timeout ⇒ Object
37 38 39 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 37 def install_timeout ENV.fetch('INSTALL_TIMEOUT').to_i end |
#om_version ⇒ Object
33 34 35 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 33 def om_version ENV.fetch('OM_VERSION') end |
#ops_manager_api_driver ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 65 def ops_manager_api_driver 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'], ) else fail "Unsupported Ops Manager Version #{om_version.inspect}" end end |
#ops_manager_driver ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 49 def ops_manager_driver (fetch_environment_settings['ops_manager']['url']) case om_version when '1.4' om_1_4(fetch_environment_settings['ops_manager']['url']) when '1.5' om_1_5(fetch_environment_settings['ops_manager']['url']) when '1.6' om_1_6(fetch_environment_settings['ops_manager']['url']) when '1.7' om_1_7(fetch_environment_settings['ops_manager']['url']) else fail "Unsupported Ops Manager Version #{om_version.inspect}" end end |
#product_name ⇒ Object
17 18 19 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 17 def product_name ENV.fetch('PRODUCT_NAME') end |
#product_path ⇒ Object
13 14 15 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 13 def product_path ENV.fetch('PRODUCT_PATH') end |
#stemcell_file_path ⇒ Object
29 30 31 |
# File 'lib/opsmgr/ui_helpers/config_helper.rb', line 29 def stemcell_file_path ENV.fetch('STEMCELL_FILE') end |