brpm_content 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (267) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +38 -0
  3. data/.travis.yml +14 -0
  4. data/Gemfile +3 -0
  5. data/LICENSE +21 -0
  6. data/README.md +308 -0
  7. data/Rakefile +24 -0
  8. data/TO_BE_MIGRATED.txt +8 -0
  9. data/architecture.png +0 -0
  10. data/brpm_content.gemspec +31 -0
  11. data/customers/demo/integrations/brpm/process_event_handler_event.rb +183 -0
  12. data/customers/demo/integrations/jenkins/spec/api/applications_spec.rb +89 -0
  13. data/customers/demo/integrations/jenkins/spec/api/plans_spec.rb +69 -0
  14. data/customers/demo/integrations/jenkins/spec/api/requests_spec.rb +57 -0
  15. data/customers/demo/integrations/jenkins/spec/spec_helper.rb +33 -0
  16. data/customers/demo/integrations/jira/process_webhook_event.rb +33 -0
  17. data/customers/demo/jira_mappings.rb +29 -0
  18. data/infrastructure/integrations/event_handler.rb +62 -0
  19. data/infrastructure/integrations/webhook_receiver.rb +49 -0
  20. data/infrastructure/shell_scripts/backup_database.sh +19 -0
  21. data/infrastructure/shell_scripts/create_bl_package.sh +34 -0
  22. data/infrastructure/shell_scripts/create_release_request.sh +34 -0
  23. data/infrastructure/shell_scripts/ddns.sh +10 -0
  24. data/infrastructure/shell_scripts/install_brpm.sh +63 -0
  25. data/infrastructure/shell_scripts/install_content_module.sh +66 -0
  26. data/infrastructure/shell_scripts/install_content_repo.sh +60 -0
  27. data/infrastructure/shell_scripts/install_module_from_gem.sh +80 -0
  28. data/infrastructure/shell_scripts/maintenance.sh +4 -0
  29. data/infrastructure/shell_scripts/patch_brpm.sh +90 -0
  30. data/infrastructure/shell_scripts/restore_database.sh +33 -0
  31. data/infrastructure/shell_scripts/run_event_handler.cmd +16 -0
  32. data/infrastructure/shell_scripts/run_event_handler.sh +20 -0
  33. data/infrastructure/shell_scripts/run_webhook_receiver.cmd +14 -0
  34. data/infrastructure/shell_scripts/run_webhook_receiver.sh +15 -0
  35. data/infrastructure/shell_scripts/update_content_repo.sh +21 -0
  36. data/infrastructure/silent_install_options_4.6.txt +93 -0
  37. data/infrastructure/silent_install_options_upgrade_4.6.txt +92 -0
  38. data/infrastructure/smtp_settings.rb +42 -0
  39. data/infrastructure/ssh_script_header_additions.rb +21 -0
  40. data/modules/ansible/automations/execute_role.rb +3 -0
  41. data/modules/ansible/automations/execute_role.txt +12 -0
  42. data/modules/ansible/config.yml +5 -0
  43. data/modules/ansible/lib/ansible.rb +41 -0
  44. data/modules/atrium_orchestrator/automations/execute_workflow.rb +12 -0
  45. data/modules/atrium_orchestrator/automations/execute_workflow.txt +25 -0
  46. data/modules/atrium_orchestrator/automations/reserve_ip_address.rb +22 -0
  47. data/modules/atrium_orchestrator/automations/reserve_ip_address.txt +21 -0
  48. data/modules/atrium_orchestrator/config.yml +7 -0
  49. data/modules/atrium_orchestrator/lib/ao_soap_client.rb +94 -0
  50. data/modules/bladelogic/automations/create_package.rb +29 -0
  51. data/modules/bladelogic/automations/create_package.txt +26 -0
  52. data/modules/bladelogic/automations/deploy_package.rb +137 -0
  53. data/modules/bladelogic/automations/deploy_package.txt +53 -0
  54. data/modules/bladelogic/config.yml +7 -0
  55. data/modules/bladelogic/lib/bl_rest/bsa_rest_client.rb +65 -0
  56. data/modules/bladelogic/lib/bl_soap/blpackage.rb +43 -0
  57. data/modules/bladelogic/lib/bl_soap/bsa_soap_base.rb +118 -0
  58. data/modules/bladelogic/lib/bl_soap/bsa_soap_client.rb +34 -0
  59. data/modules/bladelogic/lib/bl_soap/compliance_job.rb +155 -0
  60. data/modules/bladelogic/lib/bl_soap/deploy_job.rb +48 -0
  61. data/modules/bladelogic/lib/bl_soap/depot_group.rb +47 -0
  62. data/modules/bladelogic/lib/bl_soap/job.rb +376 -0
  63. data/modules/bladelogic/lib/bl_soap/job_group.rb +72 -0
  64. data/modules/bladelogic/lib/bl_soap/job_management.rb +22 -0
  65. data/modules/bladelogic/lib/bl_soap/job_result.rb +12 -0
  66. data/modules/bladelogic/lib/bl_soap/job_run.rb +271 -0
  67. data/modules/bladelogic/lib/bl_soap/login.rb +47 -0
  68. data/modules/bladelogic/lib/bl_soap/nsh_script_job.rb +14 -0
  69. data/modules/bladelogic/lib/bl_soap/patch_catalog.rb +178 -0
  70. data/modules/bladelogic/lib/bl_soap/patch_remediation_job.rb +137 -0
  71. data/modules/bladelogic/lib/bl_soap/patching_job.rb +250 -0
  72. data/modules/bladelogic/lib/bl_soap/server.rb +12 -0
  73. data/modules/bladelogic/lib/bl_soap/template.rb +13 -0
  74. data/modules/bladelogic/lib/bl_soap/utility.rb +99 -0
  75. data/modules/bladelogic/resource_automations/select_job.rb +33 -0
  76. data/modules/bladelogic/resource_automations/select_job.txt +15 -0
  77. data/modules/bladelogic/tests/create_package_spec.rb +28 -0
  78. data/modules/bladelogic/tests/deploy_package_spec.rb +23 -0
  79. data/modules/bladelogic/tests/spec_helper.rb +82 -0
  80. data/modules/brpm/automations/create_release_from_excel.rb +34 -0
  81. data/modules/brpm/automations/create_release_from_excel.txt +5 -0
  82. data/modules/brpm/automations/create_release_request.rb +100 -0
  83. data/modules/brpm/automations/create_release_request.txt +5 -0
  84. data/modules/brpm/automations/create_request.rb +73 -0
  85. data/modules/brpm/automations/create_request.txt +23 -0
  86. data/modules/brpm/automations/promote_request.rb +197 -0
  87. data/modules/brpm/automations/promote_request.txt +24 -0
  88. data/modules/brpm/automations/select_application_version.rb +22 -0
  89. data/modules/brpm/automations/select_application_version.txt +17 -0
  90. data/modules/brpm/automations/select_component_version.rb +12 -0
  91. data/modules/brpm/automations/select_component_version.txt +5 -0
  92. data/modules/brpm/automations/select_request_template.rb +6 -0
  93. data/modules/brpm/automations/select_request_template.txt +13 -0
  94. data/modules/brpm/automations/wait_for_step_in_other_request.rb +11 -0
  95. data/modules/brpm/automations/wait_for_step_in_other_request.txt +13 -0
  96. data/modules/brpm/automations/wait_till_promoted_request_is_completed.rb +9 -0
  97. data/modules/brpm/automations/wait_till_promoted_request_is_completed.txt +5 -0
  98. data/modules/brpm/config.yml +6 -0
  99. data/modules/brpm/lib/brpm_request.rb +207 -0
  100. data/modules/brpm/lib/brpm_rest.rb +312 -0
  101. data/modules/brpm/lib/brpm_rest_client.rb +1501 -0
  102. data/modules/brpm/resource_automations/select_application.rb +16 -0
  103. data/modules/brpm/resource_automations/select_application.txt +5 -0
  104. data/modules/brpm/resource_automations/select_environment.rb +14 -0
  105. data/modules/brpm/resource_automations/select_environment.txt +5 -0
  106. data/modules/brpm/resource_automations/select_request_template.rb +16 -0
  107. data/modules/brpm/resource_automations/select_request_template.txt +5 -0
  108. data/modules/brpm/resource_automations/select_step_in_request.rb +33 -0
  109. data/modules/brpm/resource_automations/select_step_in_request.txt +5 -0
  110. data/modules/brpm/sample_applications/e-finance.json +0 -0
  111. data/modules/brpm/tests/create_release_request_spec.rb +66 -0
  112. data/modules/brpm/tests/create_request_spec.rb +84 -0
  113. data/modules/brpm/tests/select_application_version_spec.rb +47 -0
  114. data/modules/brpm/tests/spec_helper.rb +63 -0
  115. data/modules/docker_brpm/automations/create_brpm_instance_input_params.rb +10 -0
  116. data/modules/docker_brpm/automations/create_brpm_instance_input_params.txt +17 -0
  117. data/modules/docker_brpm/automations/create_brpm_instance_one_shot.rb +60 -0
  118. data/modules/docker_brpm/automations/create_brpm_instance_one_shot.txt +14 -0
  119. data/modules/docker_brpm/automations/create_brpm_instance_show_results.rb +23 -0
  120. data/modules/docker_brpm/automations/create_brpm_instance_show_results.txt +13 -0
  121. data/modules/docker_brpm/automations/create_database.rb +24 -0
  122. data/modules/docker_brpm/automations/create_database.txt +3 -0
  123. data/modules/docker_brpm/automations/create_environment.rb +14 -0
  124. data/modules/docker_brpm/automations/create_environment.txt +3 -0
  125. data/modules/docker_brpm/automations/create_image_for_application.rb +23 -0
  126. data/modules/docker_brpm/automations/create_image_for_application.txt +6 -0
  127. data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.rb +7 -0
  128. data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.txt +8 -0
  129. data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.rb +7 -0
  130. data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.txt +8 -0
  131. data/modules/docker_brpm/automations/create_image_for_database_creator.rb +21 -0
  132. data/modules/docker_brpm/automations/create_image_for_database_creator.txt +6 -0
  133. data/modules/docker_brpm/automations/create_installed_component_for_application.rb +11 -0
  134. data/modules/docker_brpm/automations/create_installed_component_for_application.txt +3 -0
  135. data/modules/docker_brpm/automations/create_installed_component_for_database.rb +7 -0
  136. data/modules/docker_brpm/automations/create_installed_component_for_database.txt +3 -0
  137. data/modules/docker_brpm/automations/create_installed_component_for_database_creator.rb +8 -0
  138. data/modules/docker_brpm/automations/create_installed_component_for_database_creator.txt +3 -0
  139. data/modules/docker_brpm/automations/create_installed_component_for_utilities.rb +7 -0
  140. data/modules/docker_brpm/automations/create_installed_component_for_utilities.txt +3 -0
  141. data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.rb +13 -0
  142. data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.txt +6 -0
  143. data/modules/docker_brpm/automations/delete_brpm_instance.rb +38 -0
  144. data/modules/docker_brpm/automations/delete_brpm_instance.txt +8 -0
  145. data/modules/docker_brpm/automations/execute_test_run_in_jenkins.rb +43 -0
  146. data/modules/docker_brpm/automations/execute_test_run_in_jenkins.txt +13 -0
  147. data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.rb +5 -0
  148. data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.txt +9 -0
  149. data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.rb +27 -0
  150. data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.txt +3 -0
  151. data/modules/docker_brpm/automations/launch_test_run_request.rb +30 -0
  152. data/modules/docker_brpm/automations/launch_test_run_request.txt +14 -0
  153. data/modules/docker_brpm/automations/release_brpm_input_params.rb +7 -0
  154. data/modules/docker_brpm/automations/release_brpm_input_params.txt +8 -0
  155. data/modules/docker_brpm/automations/run_application_container.rb +27 -0
  156. data/modules/docker_brpm/automations/run_application_container.txt +3 -0
  157. data/modules/docker_brpm/automations/run_database_container.rb +14 -0
  158. data/modules/docker_brpm/automations/run_database_container.txt +3 -0
  159. data/modules/docker_brpm/automations/stop_application_container.rb +11 -0
  160. data/modules/docker_brpm/automations/stop_application_container.txt +3 -0
  161. data/modules/docker_brpm/automations/stop_database_container.rb +11 -0
  162. data/modules/docker_brpm/automations/stop_database_container.txt +3 -0
  163. data/modules/docker_brpm/automations/test_rest_api.rb +18 -0
  164. data/modules/docker_brpm/automations/test_rest_api.txt +3 -0
  165. data/modules/docker_brpm/automations/upgrade_database.rb +19 -0
  166. data/modules/docker_brpm/automations/upgrade_database.txt +8 -0
  167. data/modules/docker_brpm/config.yml +8 -0
  168. data/modules/docker_brpm/lib/docker.rb +39 -0
  169. data/modules/docker_brpm/lib/git.rb +16 -0
  170. data/modules/docker_brpm/sample_applications/dockerizedbrpm.json +0 -0
  171. data/modules/email/automations/send_notification.rb +48 -0
  172. data/modules/email/automations/send_notification.txt +27 -0
  173. data/modules/email/config.yml +6 -0
  174. data/modules/framework/automations/direct_execute.rb +10 -0
  175. data/modules/framework/automations/direct_execute.txt +16 -0
  176. data/modules/framework/automations/install_module.rb +13 -0
  177. data/modules/framework/automations/install_module.txt +16 -0
  178. data/modules/framework/bin/brpm_install +106 -0
  179. data/modules/framework/bin/event_handler +63 -0
  180. data/modules/framework/bin/webhook_receiver +49 -0
  181. data/modules/framework/brpm_auto.rb +307 -0
  182. data/modules/framework/brpm_framework.rb +88 -0
  183. data/modules/framework/brpm_script_executor.rb +146 -0
  184. data/modules/framework/config.yml +7 -0
  185. data/modules/framework/config/customer_include.rb +26 -0
  186. data/modules/framework/config/server.yml +3 -0
  187. data/modules/framework/customer_include_default.rb +25 -0
  188. data/modules/framework/lib/logging/brpm_logger.rb +39 -0
  189. data/modules/framework/lib/logging/logger_base.rb +36 -0
  190. data/modules/framework/lib/logging/simple_logger.rb +27 -0
  191. data/modules/framework/lib/params/all_params.rb +80 -0
  192. data/modules/framework/lib/params/integration_settings.rb +27 -0
  193. data/modules/framework/lib/params/params.rb +172 -0
  194. data/modules/framework/lib/params/params_base.rb +81 -0
  195. data/modules/framework/lib/params/request_params.rb +38 -0
  196. data/modules/framework/lib/resource_framework.rb +211 -0
  197. data/modules/framework/lib/rest_api.rb +155 -0
  198. data/modules/framework/lib/semaphore.rb +79 -0
  199. data/modules/framework/lib/utilities.rb +317 -0
  200. data/modules/framework/lib/version_control/git.rb +192 -0
  201. data/modules/framework/lib/version_control/svn.rb +221 -0
  202. data/modules/framework/log.html +39 -0
  203. data/modules/framework/tests/all_params_spec.rb +116 -0
  204. data/modules/framework/tests/brpm_auto_spec.rb +84 -0
  205. data/modules/framework/tests/customer_include/config/customer_include.rb +10 -0
  206. data/modules/framework/tests/customer_include/config/server.yml +3 -0
  207. data/modules/framework/tests/customer_include_spec.rb +29 -0
  208. data/modules/framework/tests/local_jirb.rb +15 -0
  209. data/modules/framework/tests/params_spec.rb +172 -0
  210. data/modules/framework/tests/request_params_spec.rb +86 -0
  211. data/modules/framework/tests/server_yaml_spec.rb +19 -0
  212. data/modules/framework/tests/spec_helper.rb +42 -0
  213. data/modules/framework/transport/dispatch_baa.rb +355 -0
  214. data/modules/framework/transport/dispatch_base.rb +345 -0
  215. data/modules/framework/transport/dispatch_nsh.rb +248 -0
  216. data/modules/framework/transport/dispatch_ssh.rb +154 -0
  217. data/modules/framework/transport/transport_baa.rb +1095 -0
  218. data/modules/framework/transport/transport_nsh.rb +359 -0
  219. data/modules/framework/transport/transport_ssh.rb +220 -0
  220. data/modules/framework/write_to.rb +1 -0
  221. data/modules/jenkins/automations/create_release.rb +4 -0
  222. data/modules/jenkins/automations/create_release.txt +23 -0
  223. data/modules/jenkins/automations/f2_downloadJenkinsArtifact.rb +126 -0
  224. data/modules/jenkins/config.yml +7 -0
  225. data/modules/jenkins/lib/jenkins.rb +300 -0
  226. data/modules/jenkins/resource_automations/f2_rsc_jenkinsJobs.rb +58 -0
  227. data/modules/jira/automations/add_comment.rb +4 -0
  228. data/modules/jira/automations/add_comment.txt +23 -0
  229. data/modules/jira/automations/create_release.rb +4 -0
  230. data/modules/jira/automations/create_release.txt +23 -0
  231. data/modules/jira/automations/delete_release.rb +4 -0
  232. data/modules/jira/automations/delete_release.txt +23 -0
  233. data/modules/jira/automations/transition_issue.rb +4 -0
  234. data/modules/jira/automations/transition_issue.txt +23 -0
  235. data/modules/jira/automations/transition_issues_for_request.rb +29 -0
  236. data/modules/jira/automations/transition_issues_for_request.txt +20 -0
  237. data/modules/jira/automations/transition_issues_for_run.rb +26 -0
  238. data/modules/jira/automations/transition_issues_for_run.txt +20 -0
  239. data/modules/jira/automations/update_release.rb +4 -0
  240. data/modules/jira/automations/update_release.txt +26 -0
  241. data/modules/jira/config.yml +7 -0
  242. data/modules/jira/lib/jira_rest_client.rb +185 -0
  243. data/modules/jira/tests/create_read_update_delete_release_spec.rb +39 -0
  244. data/modules/jira/tests/spec_helper.rb +39 -0
  245. data/modules/jira/tests/transition_issue_spec.rb +32 -0
  246. data/modules/patch_process_management/automations/execute_job/script.rb +105 -0
  247. data/modules/patch_process_management/automations/execute_job/wrapper.txt +39 -0
  248. data/modules/patch_process_management/automations/patch_analysis/script.rb +107 -0
  249. data/modules/patch_process_management/automations/patch_analysis/wrapper.txt +33 -0
  250. data/modules/patch_process_management/automations/patch_readiness/script.rb +89 -0
  251. data/modules/patch_process_management/automations/patch_readiness/wrapper.txt +33 -0
  252. data/modules/patch_process_management/automations/patch_remediation/script.rb +217 -0
  253. data/modules/patch_process_management/automations/patch_remediation/wrapper.txt +40 -0
  254. data/modules/patch_process_management/config.yml +10 -0
  255. data/modules/teamcity/automations/trigger_build.rb +4 -0
  256. data/modules/teamcity/automations/trigger_build.txt +14 -0
  257. data/modules/teamcity/config.yml +7 -0
  258. data/modules/teamcity/lib/teamcity_rest_client.rb +17 -0
  259. data/modules/teamcity/tests/spec_helper.rb +34 -0
  260. data/modules/teamcity/tests/trigger_build_spec.rb +27 -0
  261. data/modules/windows/automations/deploy_directory_over_windows_shares/script.rb +87 -0
  262. data/modules/windows/automations/deploy_directory_over_windows_shares/wrapper.txt +29 -0
  263. data/modules/windows/automations/deploy_file_over_windows_shares/script.rb +31 -0
  264. data/modules/windows/automations/deploy_file_over_windows_shares/wrapper.txt +24 -0
  265. data/modules/windows/config.yml +6 -0
  266. data/modules/windows/lib/samba.rb +29 -0
  267. metadata +397 -0
@@ -0,0 +1,21 @@
1
+ #BRPM Framework Additions
2
+ FRAMEWORK_DIR = File.dirname(File.dirname(File.expand_path(__FILE__))) unless defined?(FRAMEWORK_DIR)
3
+
4
+ def load_helpers(lib_path)
5
+ require "#{lib_path}/script_helper.rb"
6
+ require "#{lib_path}/file_in_utf.rb"
7
+ end
8
+
9
+ # BJB 7/6/2010 Append a user script to the bottom of this one for cap execution
10
+ def load_input_params(in_file)
11
+ params = YAML::load(File.open(in_file))
12
+ load_helpers(params["SS_script_support_path"])
13
+ @params = strip_private_flag(params)
14
+ #BJB 11-10-14 Intercept to load framework
15
+ initialize_framework
16
+ @params
17
+ end
18
+
19
+ def initialize_framework
20
+ require File.join(FRAMEWORK_DIR, "brpm_framework.rb")
21
+ end
@@ -0,0 +1,3 @@
1
+ server_group = get_server_group_from_step_id(params["step_id"])
2
+
3
+ execute_ansible_role(params["role"], server_group)
@@ -0,0 +1,12 @@
1
+ ###
2
+ # role:
3
+ # name: role
4
+ # required: yes
5
+ # type: in-list-single
6
+ # list_pairs: 1,common|2,db|3,haproxy|4,nagios|5,web|6,base-apache
7
+ ###
8
+ params["direct_execute"] = "true"
9
+
10
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
11
+
12
+ BrpmScriptExecutor.execute_automation_script("ansible", "execute_role", params)
@@ -0,0 +1,5 @@
1
+ dependencies:
2
+
3
+ integration_servers:
4
+
5
+ version: 1.0.0
@@ -0,0 +1,41 @@
1
+ def execute_ansible_role(role, server_group, ignore_error=false)
2
+ playbook_file_path = "/home/ansib/playbook_#{server_group}_#{role}_#{Time.now.strftime("%Y%m%d%H%M%S")}.yml"
3
+ playbook_content = <<EOF
4
+ ---
5
+ # Make sure the facts of all servers are available for the role to be applied
6
+ - hosts: all
7
+ tasks: []
8
+
9
+ - hosts: #{server_group}
10
+ sudo: True
11
+ roles:
12
+ - #{role}
13
+ EOF
14
+
15
+ BrpmAuto.log "Creating playbook.yml..."
16
+ file = File.open(playbook_file_path, 'w') {|f| f.write(playbook_content) }
17
+
18
+ complete_command = "su ansib -c \"ansible-playbook #{playbook_file_path}\" 2>&1"
19
+
20
+ BrpmAuto.log complete_command
21
+ output = `#{complete_command}`
22
+ BrpmAuto.log "\toutput: #{output}"
23
+
24
+ File.delete(playbook_file_path)
25
+
26
+ exit_status = $?.exitstatus
27
+ unless exit_status == 0
28
+ message = "The command exited with #{exit_status}."
29
+ if ignore_error
30
+ BrpmAuto.log "\t#{message}"
31
+ else
32
+ raise(message)
33
+ end
34
+ end
35
+
36
+ output
37
+ end
38
+
39
+ def execute_ansible_role_and_ignore_error(command)
40
+ execute_ansible_role(command, true)
41
+ end
@@ -0,0 +1,12 @@
1
+ params = BrpmAuto.params
2
+
3
+ workflow = params["workflow_list"].index(params["workflow"].strip)
4
+
5
+ server_group = "/#{BrpmRestClient.new.get_server_group_from_step_id(params["step_id"])}"
6
+
7
+ BrpmAuto.log("Creating the AO client...")
8
+ ao_soap_client = AoSoapClient.new
9
+
10
+ BrpmAuto.log("Executing workflow #{workflow} in AO ...")
11
+ ao_soap_client.execute_workflow("#{params["application"].downcase}-#{workflow}", { "server_group" => server_group })
12
+ BrpmAuto.log("Done.")
@@ -0,0 +1,25 @@
1
+ ###
2
+ # workflow:
3
+ # name: Workflow
4
+ # position: A1:C1
5
+ # type: in-list-single
6
+ # list_pairs: 1,Enable monitoring|2,Disable monitoring|3,Add app to loadbalancer|4,Remove app from load balancer
7
+ # required: yes
8
+ ###
9
+
10
+ #=== Remedy via AO Integration Server: AtriumOrchestrator on aws ===#
11
+ # [integration_id=7]
12
+ #=== End ===#
13
+
14
+ params["direct_execute"]=true
15
+
16
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
17
+
18
+ params["SS_integration_dns"] = SS_integration_dns
19
+ params["SS_integration_username"] = SS_integration_username
20
+ params["SS_integration_password_enc"] = SS_integration_password_enc
21
+ params["SS_integration_details"] = YAML.load(SS_integration_details)
22
+
23
+ params["workflow_list"] = { "enable-monitoring" => "Enable monitoring", "disable-monitoring" => "Disable monitoring", "add-to-loadbalancer" => "Add app to loadbalancer", "remove-from-loadbalancer" => "Remove app from loadbalancer" }
24
+
25
+ BrpmScriptExecutor.execute_automation_script("atrium_orchestrator", "execute_workflow", params)
@@ -0,0 +1,22 @@
1
+ params = BrpmAuto.params
2
+ request_params = BrpmAuto.request_params
3
+
4
+ host_name = request_params["input_name"]
5
+
6
+ BrpmAuto.log("Creating the AO client...")
7
+ ao_soap_client = AoSoapClient.new
8
+
9
+ BrpmAuto.log("Reserving an IP address in AO ...")
10
+ ip_address = ao_soap_client.reserve_ip_address(host_name)
11
+
12
+ BrpmAuto.log("Adding the IP address to the request-level parameters ...")
13
+ request_params["input_ip_address"] = ip_address
14
+ request_params["input_subnet_mask"] = "255.255.255.0"
15
+ request_params["input_gateway"] = "192.168.1.1"
16
+ request_params["input_dhcp"] = "No"
17
+ request_params["input_dns"] = ""
18
+ request_params["input_ip_resolution"] = "File"
19
+
20
+ BrpmAuto.log("Showing the IP address in the output field ...")
21
+ pack_response "IP address", ip_address
22
+
@@ -0,0 +1,21 @@
1
+ ###
2
+ # IP address:
3
+ # name: IP address
4
+ # type: out-text
5
+ # position: A1:B1
6
+ ###
7
+
8
+ #=== Remedy via AO Integration Server: AtriumOrchestrator on aws ===#
9
+ # [integration_id=7]
10
+ #=== End ===#
11
+
12
+ params["direct_execute"]=true
13
+
14
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
15
+
16
+ params["SS_integration_dns"] = SS_integration_dns
17
+ params["SS_integration_username"] = SS_integration_username
18
+ params["SS_integration_password_enc"] = SS_integration_password_enc
19
+ params["SS_integration_details"] = YAML.load(SS_integration_details)
20
+
21
+ BrpmScriptExecutor.execute_automation_script("atrium_orchestrator", "reserve_ip_address", params)
@@ -0,0 +1,7 @@
1
+ dependencies:
2
+ - BRPM
3
+
4
+ integration_servers:
5
+ - AtriumOrchestrator
6
+
7
+ version: 1.0.0
@@ -0,0 +1,94 @@
1
+ require 'yaml'
2
+ require 'savon'
3
+
4
+ class AoSoapClient
5
+ def initialize(integration_settings = BrpmAuto.integration_settings)
6
+ @url = integration_settings.dns
7
+ @username = integration_settings.username
8
+ @password = integration_settings.password
9
+
10
+ @grid_name = integration_settings.details["grid_name"]
11
+ @module_name = integration_settings.details["module_name"]
12
+ end
13
+
14
+ def reserve_ip_address(host_name)
15
+ input_param = {}
16
+ input_param["name"] = "host_name"
17
+ input_param["type"] = "xs:string"
18
+ input_param["value"] = host_name
19
+
20
+ response = soap_request("Get IP address", [ input_param ])
21
+
22
+ response[:parameter][:value][:xml_doc][:value]
23
+ end
24
+
25
+ def execute_workflow(process_name, input_params)
26
+ input_params_soap = []
27
+ input_params.each do |name, value|
28
+ input_param_soap = {}
29
+ input_param_soap["name"] = name
30
+ input_param_soap["type"] = "xs:string"
31
+ input_param_soap["value"] = value
32
+
33
+ input_params_soap << input_param_soap
34
+ end
35
+
36
+ response = soap_request(process_name, input_params_soap)
37
+
38
+ response[:parameter][:value][:xml_doc][:value]
39
+ end
40
+
41
+ private
42
+
43
+ def soap_request(process_name, input_params)
44
+ begin
45
+ HTTPI.log = false
46
+ Savon.configure do |config|
47
+ config.log = false
48
+ end
49
+
50
+ namespaces = { "xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/", "xmlns:soa" => "http://bmc.com/ao/xsd/2008/09/soa" }
51
+
52
+ client = Savon.client(@url)
53
+ client.http.auth.ssl.verify_mode = :none
54
+
55
+ response = client.request :execute_process do
56
+ soap.xml do |xml|
57
+ xml.soapenv(:Envelope, namespaces) do |xml|
58
+ xml.soapenv(:Header) do |xml|
59
+ xml.wsse(:Security, "soapenv:mustUnderstand" => "1", "xmlns:wsse" => "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd") do |xml|
60
+ xml.wsse(:UsernameToken) do |xml|
61
+ xml.wsse(:Username, @username)
62
+ xml.wsse(:Password, @password, "Type" => "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText")
63
+ end
64
+ end
65
+ end
66
+ xml.soapenv(:Body) do |xml|
67
+ xml.soa(:executeProcess) do |xml|
68
+ xml.soa(:gridName, @grid_name)
69
+ xml.soa(:moduleName, @module_name)
70
+ xml.soa(:processName, ":#{@module_name}:#{process_name}")
71
+ xml.soa(:parameters) do |xml|
72
+ xml.soa(:Input) do |xml|
73
+ input_params.each do |input_param|
74
+ xml.soa(:Parameter) do |xml|
75
+ xml.soa(:Name, input_param["name"], :required => true)
76
+ xml.soa(:Value, "soa:type" => input_param["type"]) do |xml|
77
+ xml.soa(:Text, input_param["value"])
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
87
+ end
88
+
89
+ response.body[:execute_process_response][:output][:output]
90
+ rescue => e
91
+ raise("AO SOAP request failed: #{e.message}\n#{e.backtrace}")
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,29 @@
1
+ params = BrpmAuto.params
2
+
3
+ bl_build_component_name = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["bl_build_component_name"]), "#{params["component"]} - build")
4
+ depot_group_path = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["depot_group_path"]), "/Applications/#{params["application"]}/#{params["component"]}")
5
+ package_name = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["bl_package_name"]), params["component_version"])
6
+
7
+ BrpmAuto.log("Retrieving the key of the bl component of the build server #{bl_build_component_name}...")
8
+ bsa_rest_client = BsaRestClient.new
9
+ bl_build_component = bsa_rest_client.get_component_by_name(bl_build_component_name)
10
+
11
+ BrpmAuto.log("Logging on to Bladelogic...")
12
+ bsa_soap_client = BsaSoapClient.new
13
+
14
+ BrpmAuto.log("Retrieving the id of the bl depot group of the package #{depot_group_path}...")
15
+ depot_group_id = bsa_soap_client.depot_group.group_name_to_id({:group_name => depot_group_path})
16
+ depot_group_id = depot_group_id.to_i #is this necessary?
17
+
18
+ BrpmAuto.log("Creating blpackage #{depot_group_path}/#{package_name}...")
19
+ bsa_soap_client.blpackage.create_package_from_component({:package_name => package_name, :depot_group_id => depot_group_id, :component_key => bl_build_component["dbKey"]})
20
+
21
+ brpm_rest_client = BrpmRestClient.new
22
+
23
+ BrpmAuto.log "Getting all environments of application #{params["application"]} ..."
24
+ environments = brpm_rest_client.get_environments_of_application(params["application"])
25
+
26
+ environments.each do |environment|
27
+ BrpmAuto.log "Creating the version tag for version #{params["component_version"]} of application #{params["application"]} and component #{params["component"]} in environment #{environment["name"]} ..."
28
+ environment = brpm_rest_client.create_version_tag(params["application"], params["component"], environment["name"], params["component_version"])
29
+ end
@@ -0,0 +1,26 @@
1
+ ###
2
+ # bl_build_component_name:
3
+ # name: Bladelogic build component name
4
+ # position: A1:C1
5
+ # depot_group_path:
6
+ # name: Depot group path
7
+ # position: A2:D2
8
+ # bl_package_name:
9
+ # name: Bladelogic package name
10
+ # position: A3:C3
11
+ ###
12
+
13
+ #=== BMC Application Automation Integration Server: BladeLogic on aws ===#
14
+ # [integration_id=6]
15
+ #=== End ===#
16
+
17
+ require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
18
+
19
+ params["direct_execute"] = true
20
+
21
+ params["SS_integration_dns"] = SS_integration_dns
22
+ params["SS_integration_username"] = SS_integration_username
23
+ params["SS_integration_password_enc"] = SS_integration_password_enc
24
+ params["SS_integration_details"] = YAML.load(SS_integration_details)
25
+
26
+ BrpmScriptExecutor.execute_automation_script("bladelogic", "create_package", params)
@@ -0,0 +1,137 @@
1
+ params = BrpmAuto.params
2
+ brpm_rest_client = BrpmRestClient.new
3
+
4
+ environment = params.request_environment
5
+ unless params["server_group"] # can already be populated by the automated tests
6
+ BrpmAuto.log("Getting the server group from the step...")
7
+ params["server_group"] = brpm_rest_client.get_server_group_from_step_id(params["step_id"])
8
+ end
9
+ server_group = params["server_group"]
10
+
11
+ target_type = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["target_type"]), "Server group")
12
+ target_path = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["target_path"]), "/Applications/#{params["application"]}/#{params["request_environment"]}/#{server_group}")
13
+
14
+ deploy_job_name = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["deploy_job_name"]), "Deploy #{params["component"]} #{params["component_version"]} in #{environment} - #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}")
15
+ deploy_job_group_path = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["deploy_job_group_path"]), "/Applications/#{params["application"]}")
16
+
17
+ depot_group_path = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["depot_group_path"]), "/Applications/#{params["application"]}/#{params["component"]}")
18
+ package_name = BrpmAuto.first_defined(BrpmAuto.substitute_tokens(params["bl_package_name"]), params["component_version"])
19
+
20
+ BrpmAuto.log("Logging on to Bladelogic...")
21
+ bsa_soap_client = BsaSoapClient.new
22
+
23
+ BrpmAuto.log("Retrieving the db key of blpackage #{depot_group_path}/#{package_name}...")
24
+ package_db_key = bsa_soap_client.blpackage.get_dbkey_by_group_and_name({:parent_group => depot_group_path, :depot_group_path => package_name })
25
+
26
+ BrpmAuto.log("Retrieving the id of job group #{deploy_job_group_path}...")
27
+ deploy_job_group_id = bsa_soap_client.job_group.group_name_to_id({:group_name => deploy_job_group_path })
28
+
29
+ BrpmAuto.log("Creating Deploy job #{deploy_job_group_path}/#{deploy_job_name}...")
30
+ job_db_key = bsa_soap_client.deploy_job.create_deploy_job({:job_name => deploy_job_name, :group_id => deploy_job_group_id, :package_db_key => package_db_key, :server_name => "localhost" })
31
+
32
+ BrpmAuto.log("Cleaning the servers from the Deploy job...")
33
+ job_db_key = bsa_soap_client.job.clear_target_servers({:job_key => job_db_key})
34
+
35
+ if target_type == "Server group"
36
+ BrpmAuto.log("Adding server group #{target_path} to the Deploy job...")
37
+ job_db_key = bsa_soap_client.job.add_target_group({:job_key => job_db_key, :group_name => target_path})
38
+ elsif target_type == "Component group"
39
+ BrpmAuto.log("Adding component group #{target_path} to the Deploy job...")
40
+ job_db_key = bsa_soap_client.job.add_target_component_group({:job_key => job_db_key, :group_name => target_path})
41
+ end
42
+
43
+ BrpmAuto.log("Executing the Deploy job...")
44
+ job_run_key = bsa_soap_client.job.execute_job_and_wait({:job_key => job_db_key})
45
+ BrpmAuto.log("Job run key is #{job_run_key}.")
46
+
47
+ BrpmAuto.log("Checking if the job finished successfully...")
48
+ had_errors = bsa_soap_client.job_run.get_job_run_had_errors({:job_run_key => job_run_key})
49
+
50
+ had_errors ? BrpmAuto.log("WARNING: The job had errors!") : BrpmAuto.log("The job had no errors.")
51
+ pack_response "job_status", had_errors ? "The job had errors" : "The job ran successfully"
52
+
53
+ BrpmAuto.log("Retrieving the job run id from the job run key...")
54
+ job_run_id = bsa_soap_client.job_run.job_run_key_to_job_run_id({:job_run_key => job_run_key})
55
+
56
+ results_full_path = "#{params.output_dir}/#{deploy_job_name}_result.csv"
57
+
58
+ BrpmAuto.log("Retrieving the results from the job run id...")
59
+ return_data = bsa_soap_client.utility.export_deploy_script_run({
60
+ :job_group_name => deploy_job_group_path,
61
+ :job_name => deploy_job_name,
62
+ :run_id => job_run_id,
63
+ :export_file_name => results_full_path})
64
+ results_content = Base64.decode64(return_data)
65
+
66
+ File.open(results_full_path, "w") do |f|
67
+ f.puts(results_content)
68
+ end
69
+
70
+ BrpmAuto.log("Parsing the results...")
71
+ # As this export contains "embedded" double quotes it is not possible to parse it with the CSV library
72
+ log_lines = results_content.split("\n")[6..-1]
73
+ log_lines.select! { |log| !log.start_with?("run level log,") }
74
+
75
+ logs = log_lines.map do |log_line|
76
+ log_items = log_line.split(",",7)
77
+
78
+ # 0: server
79
+ # 1: phase
80
+ # 2: attempt
81
+ # 3: date part 1
82
+ # 4: date part 2
83
+ # 5: Info - Warning - Error
84
+ # 6: message
85
+
86
+ if log_items.count < 7 # Some lines are broken in two because of end-of-lines appearing in the message field...
87
+ nil
88
+ else
89
+ log_items[6] = log_items[6].tr(",,","")
90
+ log_items[3] = DateTime.parse("#{log_items[3]},#{log_items[4]}")
91
+
92
+ log_items
93
+ end
94
+ end
95
+
96
+ logs = logs.compact # removing the possible nils from the array
97
+
98
+ logs = logs.sort_by { |log| [log[0], log[1], log[3]] }
99
+
100
+ servers_with_logs = logs.group_by { |log| log[0] }
101
+
102
+ failed_servers_with_logs = servers_with_logs.select { |key, value| value.select{|log| log[5] == "Error" }.count > 0}
103
+
104
+ pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
105
+
106
+ table_data = [[' ', 'Server', 'Simulate', 'Stage', 'Commit']]
107
+ counter = 0
108
+ servers_with_logs.each do |key, logs|
109
+ server = key
110
+
111
+ phase_with_logs = logs.group_by { |log| log[1] }
112
+
113
+ if phase_with_logs.has_key?("Simulate")
114
+ simulate = phase_with_logs["Simulate"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
115
+ else
116
+ simulate = ""
117
+ end
118
+ if phase_with_logs.has_key?("Stage")
119
+ stage = phase_with_logs["Stage"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
120
+ else
121
+ stage = ""
122
+ end
123
+ if phase_with_logs.has_key?("Commit")
124
+ commit = phase_with_logs["Commit"].any? { |log| log[5] == "Error" } ? "Error" : "Succeeded"
125
+ else
126
+ commit = ""
127
+ end
128
+
129
+ counter += 1
130
+ table_data << [counter, server, simulate, stage, commit]
131
+ end
132
+
133
+ pack_response "results", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
134
+
135
+ pack_response "results_link", results_full_path
136
+
137
+ raise "The Deploy job had errors!" if had_errors