Class: Params
- Inherits:
-
ParamsBase
- Object
- Hash
- ParamsBase
- Params
- Defined in:
- lib/params/params.rb
Instance Attribute Summary collapse
-
#also_log_to_console ⇒ Object
readonly
Returns the value of attribute also_log_to_console.
-
#application ⇒ Object
readonly
Returns the value of attribute application.
-
#automation_results_dir ⇒ Object
readonly
Returns the value of attribute automation_results_dir.
-
#brpm_api_token ⇒ Object
readonly
Returns the value of attribute brpm_api_token.
-
#brpm_url ⇒ Object
readonly
Returns the value of attribute brpm_url.
-
#component ⇒ Object
readonly
Returns the value of attribute component.
-
#component_version ⇒ Object
readonly
Returns the value of attribute component_version.
-
#config_dir ⇒ Object
readonly
Returns the value of attribute config_dir.
-
#home_dir ⇒ Object
readonly
Returns the value of attribute home_dir.
-
#log_file ⇒ Object
readonly
Returns the value of attribute log_file.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#output_file ⇒ Object
readonly
Returns the value of attribute output_file.
-
#private_params ⇒ Object
readonly
Returns the value of attribute private_params.
-
#request_environment ⇒ Object
readonly
Returns the value of attribute request_environment.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#request_name ⇒ Object
readonly
Returns the value of attribute request_name.
-
#request_number ⇒ Object
readonly
Returns the value of attribute request_number.
-
#request_plan ⇒ Object
readonly
Returns the value of attribute request_plan.
-
#request_plan_id ⇒ Object
readonly
Returns the value of attribute request_plan_id.
-
#request_plan_member_id ⇒ Object
readonly
Returns the value of attribute request_plan_member_id.
-
#request_plan_stage ⇒ Object
readonly
Returns the value of attribute request_plan_stage.
-
#request_run_id ⇒ Object
readonly
Returns the value of attribute request_run_id.
-
#request_run_name ⇒ Object
readonly
Returns the value of attribute request_run_name.
-
#request_scheduled_at ⇒ Object
readonly
Returns the value of attribute request_scheduled_at.
-
#request_started_at ⇒ Object
readonly
Returns the value of attribute request_started_at.
-
#request_status ⇒ Object
readonly
Returns the value of attribute request_status.
-
#run_from_brpm ⇒ Object
readonly
Returns the value of attribute run_from_brpm.
-
#run_key ⇒ Object
readonly
Returns the value of attribute run_key.
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
-
#step_description ⇒ Object
readonly
Returns the value of attribute step_description.
-
#step_estimate ⇒ Object
readonly
Returns the value of attribute step_estimate.
-
#step_id ⇒ Object
readonly
Returns the value of attribute step_id.
-
#step_name ⇒ Object
readonly
Returns the value of attribute step_name.
-
#step_number ⇒ Object
readonly
Returns the value of attribute step_number.
-
#step_version ⇒ Object
readonly
Returns the value of attribute step_version.
-
#step_version_artifact_url ⇒ Object
readonly
Returns the value of attribute step_version_artifact_url.
-
#ticket_ids ⇒ Object
readonly
Returns the value of attribute ticket_ids.
-
#tickets_foreign_ids ⇒ Object
readonly
Returns the value of attribute tickets_foreign_ids.
-
#unit_test ⇒ Object
readonly
Returns the value of attribute unit_test.
Instance Method Summary collapse
-
#get_server_property(server, property) ⇒ Object
Fetches the property value for a server.
-
#get_servers_by_os_platform(os_platform, alt_servers = nil) ⇒ Object
Servers in params need to be filtered by OS.
-
#initialize(params) ⇒ Params
constructor
A new instance of Params.
-
#rest_request_id ⇒ Object
Returns the request id for use in rest calls.
Methods inherited from ParamsBase
#[], #add, #find_or_add, #get, #method_missing, #required
Constructor Details
#initialize(params) ⇒ Params
Returns a new instance of Params.
57 58 59 60 61 62 63 64 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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/params/params.rb', line 57 def initialize(params) self.merge!(params) @application = params["application"] @component = params["component"] @component_version = params["component_version"] @request_id = params["request_id"] @request_name = params["request_name"] @request_number = params["request_number"] @request_environment = params["request_environment"] @request_scheduled_at = params["request_scheduled_at"] @request_started_at = params["request_started_at"] @request_status = params["request_status"] @request_plan = params["request_plan"] @request_plan_id = params["request_plan_id"] @request_plan_member_id = params["request_plan_member_id"] @request_plan_stage = params["request_plan_stage"] @request_run_id = params["request_run_id"] @request_run_name = params["request_run_name"] @step_id = params["step_id"] @step_number = params["step_number"] @step_name = params["step_name"] @step_description = params["step_description"] @step_estimate = params["step_estimate"] @step_version = params["step_version"] @step_version_artifact_url = params["step_version_artifact_url"] @servers = get_server_list @ticket_ids = params["ticket_ids"] @tickets_foreign_ids = params["tickets_foreign_ids"] @run_key = params["SS_run_key"] || params["run_key"] if params["SS_automation_results_dir"] @home_dir = params["SS_automation_results_dir"].sub("/automation_results", "") else @home_dir = params["home_dir"] || Dir.pwd end @automation_results_dir = params["SS_automation_results_dir"] @output_dir = params["SS_output_dir"] || params["output_dir"] || Dir.pwd @output_file = params["SS_output_file"] @config_dir = "#{@home_dir}/config" @log_file = params["log_file"] || "#{@output_dir}/brpm_auto.log" @brpm_url = params["SS_base_url"] || params["brpm_url"] @brpm_api_token = params["SS_api_token"] || params["brpm_api_token"] @run_from_brpm = (@run_key != nil) @unit_test = (params["unit_test"] == "true" || params["unit_test"] == 'true') @also_log_to_console = (params["also_log_to_console"] == "true" || params["also_log_to_console"] == 'true') @private_params = {} if self.run_from_brpm params.each do |k,v| if k.end_with?("_encrypt") || k.end_with?("_enc") if k.end_with?("_encrypt") key_decrypted = k.gsub("_encrypt","") elsif k.end_with?("_enc") key_decrypted = k.gsub("_enc","") end value_decrypted = decrypt_string_with_prefix(v) @private_params[key_decrypted] = value_decrypted end end end self.merge!(@private_params) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ParamsBase
Instance Attribute Details
#also_log_to_console ⇒ Object (readonly)
Returns the value of attribute also_log_to_console.
53 54 55 |
# File 'lib/params/params.rb', line 53 def also_log_to_console @also_log_to_console end |
#application ⇒ Object (readonly)
Returns the value of attribute application.
4 5 6 |
# File 'lib/params/params.rb', line 4 def application @application end |
#automation_results_dir ⇒ Object (readonly)
Returns the value of attribute automation_results_dir.
41 42 43 |
# File 'lib/params/params.rb', line 41 def automation_results_dir @automation_results_dir end |
#brpm_api_token ⇒ Object (readonly)
Returns the value of attribute brpm_api_token.
49 50 51 |
# File 'lib/params/params.rb', line 49 def brpm_api_token @brpm_api_token end |
#brpm_url ⇒ Object (readonly)
Returns the value of attribute brpm_url.
48 49 50 |
# File 'lib/params/params.rb', line 48 def brpm_url @brpm_url end |
#component ⇒ Object (readonly)
Returns the value of attribute component.
5 6 7 |
# File 'lib/params/params.rb', line 5 def component @component end |
#component_version ⇒ Object (readonly)
Returns the value of attribute component_version.
6 7 8 |
# File 'lib/params/params.rb', line 6 def component_version @component_version end |
#config_dir ⇒ Object (readonly)
Returns the value of attribute config_dir.
44 45 46 |
# File 'lib/params/params.rb', line 44 def config_dir @config_dir end |
#home_dir ⇒ Object (readonly)
Returns the value of attribute home_dir.
40 41 42 |
# File 'lib/params/params.rb', line 40 def home_dir @home_dir end |
#log_file ⇒ Object (readonly)
Returns the value of attribute log_file.
46 47 48 |
# File 'lib/params/params.rb', line 46 def log_file @log_file end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
42 43 44 |
# File 'lib/params/params.rb', line 42 def output_dir @output_dir end |
#output_file ⇒ Object (readonly)
Returns the value of attribute output_file.
43 44 45 |
# File 'lib/params/params.rb', line 43 def output_file @output_file end |
#private_params ⇒ Object (readonly)
Returns the value of attribute private_params.
55 56 57 |
# File 'lib/params/params.rb', line 55 def private_params @private_params end |
#request_environment ⇒ Object (readonly)
Returns the value of attribute request_environment.
11 12 13 |
# File 'lib/params/params.rb', line 11 def request_environment @request_environment end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
8 9 10 |
# File 'lib/params/params.rb', line 8 def request_id @request_id end |
#request_name ⇒ Object (readonly)
Returns the value of attribute request_name.
9 10 11 |
# File 'lib/params/params.rb', line 9 def request_name @request_name end |
#request_number ⇒ Object (readonly)
Returns the value of attribute request_number.
10 11 12 |
# File 'lib/params/params.rb', line 10 def request_number @request_number end |
#request_plan ⇒ Object (readonly)
Returns the value of attribute request_plan.
16 17 18 |
# File 'lib/params/params.rb', line 16 def request_plan @request_plan end |
#request_plan_id ⇒ Object (readonly)
Returns the value of attribute request_plan_id.
17 18 19 |
# File 'lib/params/params.rb', line 17 def request_plan_id @request_plan_id end |
#request_plan_member_id ⇒ Object (readonly)
Returns the value of attribute request_plan_member_id.
18 19 20 |
# File 'lib/params/params.rb', line 18 def request_plan_member_id @request_plan_member_id end |
#request_plan_stage ⇒ Object (readonly)
Returns the value of attribute request_plan_stage.
19 20 21 |
# File 'lib/params/params.rb', line 19 def request_plan_stage @request_plan_stage end |
#request_run_id ⇒ Object (readonly)
Returns the value of attribute request_run_id.
21 22 23 |
# File 'lib/params/params.rb', line 21 def request_run_id @request_run_id end |
#request_run_name ⇒ Object (readonly)
Returns the value of attribute request_run_name.
22 23 24 |
# File 'lib/params/params.rb', line 22 def request_run_name @request_run_name end |
#request_scheduled_at ⇒ Object (readonly)
Returns the value of attribute request_scheduled_at.
12 13 14 |
# File 'lib/params/params.rb', line 12 def request_scheduled_at @request_scheduled_at end |
#request_started_at ⇒ Object (readonly)
Returns the value of attribute request_started_at.
13 14 15 |
# File 'lib/params/params.rb', line 13 def request_started_at @request_started_at end |
#request_status ⇒ Object (readonly)
Returns the value of attribute request_status.
14 15 16 |
# File 'lib/params/params.rb', line 14 def request_status @request_status end |
#run_from_brpm ⇒ Object (readonly)
Returns the value of attribute run_from_brpm.
51 52 53 |
# File 'lib/params/params.rb', line 51 def run_from_brpm @run_from_brpm end |
#run_key ⇒ Object (readonly)
Returns the value of attribute run_key.
38 39 40 |
# File 'lib/params/params.rb', line 38 def run_key @run_key end |
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
33 34 35 |
# File 'lib/params/params.rb', line 33 def servers @servers end |
#step_description ⇒ Object (readonly)
Returns the value of attribute step_description.
27 28 29 |
# File 'lib/params/params.rb', line 27 def step_description @step_description end |
#step_estimate ⇒ Object (readonly)
Returns the value of attribute step_estimate.
28 29 30 |
# File 'lib/params/params.rb', line 28 def step_estimate @step_estimate end |
#step_id ⇒ Object (readonly)
Returns the value of attribute step_id.
24 25 26 |
# File 'lib/params/params.rb', line 24 def step_id @step_id end |
#step_name ⇒ Object (readonly)
Returns the value of attribute step_name.
26 27 28 |
# File 'lib/params/params.rb', line 26 def step_name @step_name end |
#step_number ⇒ Object (readonly)
Returns the value of attribute step_number.
25 26 27 |
# File 'lib/params/params.rb', line 25 def step_number @step_number end |
#step_version ⇒ Object (readonly)
Returns the value of attribute step_version.
30 31 32 |
# File 'lib/params/params.rb', line 30 def step_version @step_version end |
#step_version_artifact_url ⇒ Object (readonly)
Returns the value of attribute step_version_artifact_url.
31 32 33 |
# File 'lib/params/params.rb', line 31 def step_version_artifact_url @step_version_artifact_url end |
#ticket_ids ⇒ Object (readonly)
Returns the value of attribute ticket_ids.
35 36 37 |
# File 'lib/params/params.rb', line 35 def ticket_ids @ticket_ids end |
#tickets_foreign_ids ⇒ Object (readonly)
Returns the value of attribute tickets_foreign_ids.
36 37 38 |
# File 'lib/params/params.rb', line 36 def tickets_foreign_ids @tickets_foreign_ids end |
#unit_test ⇒ Object (readonly)
Returns the value of attribute unit_test.
52 53 54 |
# File 'lib/params/params.rb', line 52 def unit_test @unit_test end |
Instance Method Details
#get_server_property(server, property) ⇒ Object
Fetches the property value for a server
Returns
-
property value
143 144 145 146 147 |
# File 'lib/params/params.rb', line 143 def get_server_property(server, property) ans = "" ans = @servers[server][property] if @servers.has_key?(server) && @servers[server].has_key?(property) ans end |
#get_servers_by_os_platform(os_platform, alt_servers = nil) ⇒ Object
Servers in params need to be filtered by OS
133 134 135 136 |
# File 'lib/params/params.rb', line 133 def get_servers_by_os_platform(os_platform, alt_servers = nil) servers = alt_servers || @servers result = servers.select{|k,v| v["os_platform"].downcase =~ /#{os_platform}/ } end |
#rest_request_id ⇒ Object
Returns the request id for use in rest calls
151 152 153 |
# File 'lib/params/params.rb', line 151 def rest_request_id (self["request_id"].to_i - 1000).to_s end |