brpm_content 0.1.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +38 -0
- data/.travis.yml +14 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +308 -0
- data/Rakefile +24 -0
- data/TO_BE_MIGRATED.txt +8 -0
- data/architecture.png +0 -0
- data/brpm_content.gemspec +31 -0
- data/customers/demo/integrations/brpm/process_event_handler_event.rb +183 -0
- data/customers/demo/integrations/jenkins/spec/api/applications_spec.rb +89 -0
- data/customers/demo/integrations/jenkins/spec/api/plans_spec.rb +69 -0
- data/customers/demo/integrations/jenkins/spec/api/requests_spec.rb +57 -0
- data/customers/demo/integrations/jenkins/spec/spec_helper.rb +33 -0
- data/customers/demo/integrations/jira/process_webhook_event.rb +33 -0
- data/customers/demo/jira_mappings.rb +29 -0
- data/infrastructure/integrations/event_handler.rb +62 -0
- data/infrastructure/integrations/webhook_receiver.rb +49 -0
- data/infrastructure/shell_scripts/backup_database.sh +19 -0
- data/infrastructure/shell_scripts/create_bl_package.sh +34 -0
- data/infrastructure/shell_scripts/create_release_request.sh +34 -0
- data/infrastructure/shell_scripts/ddns.sh +10 -0
- data/infrastructure/shell_scripts/install_brpm.sh +63 -0
- data/infrastructure/shell_scripts/install_content_module.sh +66 -0
- data/infrastructure/shell_scripts/install_content_repo.sh +60 -0
- data/infrastructure/shell_scripts/install_module_from_gem.sh +80 -0
- data/infrastructure/shell_scripts/maintenance.sh +4 -0
- data/infrastructure/shell_scripts/patch_brpm.sh +90 -0
- data/infrastructure/shell_scripts/restore_database.sh +33 -0
- data/infrastructure/shell_scripts/run_event_handler.cmd +16 -0
- data/infrastructure/shell_scripts/run_event_handler.sh +20 -0
- data/infrastructure/shell_scripts/run_webhook_receiver.cmd +14 -0
- data/infrastructure/shell_scripts/run_webhook_receiver.sh +15 -0
- data/infrastructure/shell_scripts/update_content_repo.sh +21 -0
- data/infrastructure/silent_install_options_4.6.txt +93 -0
- data/infrastructure/silent_install_options_upgrade_4.6.txt +92 -0
- data/infrastructure/smtp_settings.rb +42 -0
- data/infrastructure/ssh_script_header_additions.rb +21 -0
- data/modules/ansible/automations/execute_role.rb +3 -0
- data/modules/ansible/automations/execute_role.txt +12 -0
- data/modules/ansible/config.yml +5 -0
- data/modules/ansible/lib/ansible.rb +41 -0
- data/modules/atrium_orchestrator/automations/execute_workflow.rb +12 -0
- data/modules/atrium_orchestrator/automations/execute_workflow.txt +25 -0
- data/modules/atrium_orchestrator/automations/reserve_ip_address.rb +22 -0
- data/modules/atrium_orchestrator/automations/reserve_ip_address.txt +21 -0
- data/modules/atrium_orchestrator/config.yml +7 -0
- data/modules/atrium_orchestrator/lib/ao_soap_client.rb +94 -0
- data/modules/bladelogic/automations/create_package.rb +29 -0
- data/modules/bladelogic/automations/create_package.txt +26 -0
- data/modules/bladelogic/automations/deploy_package.rb +137 -0
- data/modules/bladelogic/automations/deploy_package.txt +53 -0
- data/modules/bladelogic/config.yml +7 -0
- data/modules/bladelogic/lib/bl_rest/bsa_rest_client.rb +65 -0
- data/modules/bladelogic/lib/bl_soap/blpackage.rb +43 -0
- data/modules/bladelogic/lib/bl_soap/bsa_soap_base.rb +118 -0
- data/modules/bladelogic/lib/bl_soap/bsa_soap_client.rb +34 -0
- data/modules/bladelogic/lib/bl_soap/compliance_job.rb +155 -0
- data/modules/bladelogic/lib/bl_soap/deploy_job.rb +48 -0
- data/modules/bladelogic/lib/bl_soap/depot_group.rb +47 -0
- data/modules/bladelogic/lib/bl_soap/job.rb +376 -0
- data/modules/bladelogic/lib/bl_soap/job_group.rb +72 -0
- data/modules/bladelogic/lib/bl_soap/job_management.rb +22 -0
- data/modules/bladelogic/lib/bl_soap/job_result.rb +12 -0
- data/modules/bladelogic/lib/bl_soap/job_run.rb +271 -0
- data/modules/bladelogic/lib/bl_soap/login.rb +47 -0
- data/modules/bladelogic/lib/bl_soap/nsh_script_job.rb +14 -0
- data/modules/bladelogic/lib/bl_soap/patch_catalog.rb +178 -0
- data/modules/bladelogic/lib/bl_soap/patch_remediation_job.rb +137 -0
- data/modules/bladelogic/lib/bl_soap/patching_job.rb +250 -0
- data/modules/bladelogic/lib/bl_soap/server.rb +12 -0
- data/modules/bladelogic/lib/bl_soap/template.rb +13 -0
- data/modules/bladelogic/lib/bl_soap/utility.rb +99 -0
- data/modules/bladelogic/resource_automations/select_job.rb +33 -0
- data/modules/bladelogic/resource_automations/select_job.txt +15 -0
- data/modules/bladelogic/tests/create_package_spec.rb +28 -0
- data/modules/bladelogic/tests/deploy_package_spec.rb +23 -0
- data/modules/bladelogic/tests/spec_helper.rb +82 -0
- data/modules/brpm/automations/create_release_from_excel.rb +34 -0
- data/modules/brpm/automations/create_release_from_excel.txt +5 -0
- data/modules/brpm/automations/create_release_request.rb +100 -0
- data/modules/brpm/automations/create_release_request.txt +5 -0
- data/modules/brpm/automations/create_request.rb +73 -0
- data/modules/brpm/automations/create_request.txt +23 -0
- data/modules/brpm/automations/promote_request.rb +197 -0
- data/modules/brpm/automations/promote_request.txt +24 -0
- data/modules/brpm/automations/select_application_version.rb +22 -0
- data/modules/brpm/automations/select_application_version.txt +17 -0
- data/modules/brpm/automations/select_component_version.rb +12 -0
- data/modules/brpm/automations/select_component_version.txt +5 -0
- data/modules/brpm/automations/select_request_template.rb +6 -0
- data/modules/brpm/automations/select_request_template.txt +13 -0
- data/modules/brpm/automations/wait_for_step_in_other_request.rb +11 -0
- data/modules/brpm/automations/wait_for_step_in_other_request.txt +13 -0
- data/modules/brpm/automations/wait_till_promoted_request_is_completed.rb +9 -0
- data/modules/brpm/automations/wait_till_promoted_request_is_completed.txt +5 -0
- data/modules/brpm/config.yml +6 -0
- data/modules/brpm/lib/brpm_request.rb +207 -0
- data/modules/brpm/lib/brpm_rest.rb +312 -0
- data/modules/brpm/lib/brpm_rest_client.rb +1501 -0
- data/modules/brpm/resource_automations/select_application.rb +16 -0
- data/modules/brpm/resource_automations/select_application.txt +5 -0
- data/modules/brpm/resource_automations/select_environment.rb +14 -0
- data/modules/brpm/resource_automations/select_environment.txt +5 -0
- data/modules/brpm/resource_automations/select_request_template.rb +16 -0
- data/modules/brpm/resource_automations/select_request_template.txt +5 -0
- data/modules/brpm/resource_automations/select_step_in_request.rb +33 -0
- data/modules/brpm/resource_automations/select_step_in_request.txt +5 -0
- data/modules/brpm/sample_applications/e-finance.json +0 -0
- data/modules/brpm/tests/create_release_request_spec.rb +66 -0
- data/modules/brpm/tests/create_request_spec.rb +84 -0
- data/modules/brpm/tests/select_application_version_spec.rb +47 -0
- data/modules/brpm/tests/spec_helper.rb +63 -0
- data/modules/docker_brpm/automations/create_brpm_instance_input_params.rb +10 -0
- data/modules/docker_brpm/automations/create_brpm_instance_input_params.txt +17 -0
- data/modules/docker_brpm/automations/create_brpm_instance_one_shot.rb +60 -0
- data/modules/docker_brpm/automations/create_brpm_instance_one_shot.txt +14 -0
- data/modules/docker_brpm/automations/create_brpm_instance_show_results.rb +23 -0
- data/modules/docker_brpm/automations/create_brpm_instance_show_results.txt +13 -0
- data/modules/docker_brpm/automations/create_database.rb +24 -0
- data/modules/docker_brpm/automations/create_database.txt +3 -0
- data/modules/docker_brpm/automations/create_environment.rb +14 -0
- data/modules/docker_brpm/automations/create_environment.txt +3 -0
- data/modules/docker_brpm/automations/create_image_for_application.rb +23 -0
- data/modules/docker_brpm/automations/create_image_for_application.txt +6 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.rb +7 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_application_input_params.txt +8 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.rb +7 -0
- data/modules/docker_brpm/automations/create_image_for_brpm_database_creator_input_params.txt +8 -0
- data/modules/docker_brpm/automations/create_image_for_database_creator.rb +21 -0
- data/modules/docker_brpm/automations/create_image_for_database_creator.txt +6 -0
- data/modules/docker_brpm/automations/create_installed_component_for_application.rb +11 -0
- data/modules/docker_brpm/automations/create_installed_component_for_application.txt +3 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database.rb +7 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database.txt +3 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database_creator.rb +8 -0
- data/modules/docker_brpm/automations/create_installed_component_for_database_creator.txt +3 -0
- data/modules/docker_brpm/automations/create_installed_component_for_utilities.rb +7 -0
- data/modules/docker_brpm/automations/create_installed_component_for_utilities.txt +3 -0
- data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.rb +13 -0
- data/modules/docker_brpm/automations/create_version_tags_for_component_in_all_envs.txt +6 -0
- data/modules/docker_brpm/automations/delete_brpm_instance.rb +38 -0
- data/modules/docker_brpm/automations/delete_brpm_instance.txt +8 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins.rb +43 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins.txt +13 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.rb +5 -0
- data/modules/docker_brpm/automations/execute_test_run_in_jenkins_show_results.txt +9 -0
- data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.rb +27 -0
- data/modules/docker_brpm/automations/launch_create_image_for_brpm_application_request.txt +3 -0
- data/modules/docker_brpm/automations/launch_test_run_request.rb +30 -0
- data/modules/docker_brpm/automations/launch_test_run_request.txt +14 -0
- data/modules/docker_brpm/automations/release_brpm_input_params.rb +7 -0
- data/modules/docker_brpm/automations/release_brpm_input_params.txt +8 -0
- data/modules/docker_brpm/automations/run_application_container.rb +27 -0
- data/modules/docker_brpm/automations/run_application_container.txt +3 -0
- data/modules/docker_brpm/automations/run_database_container.rb +14 -0
- data/modules/docker_brpm/automations/run_database_container.txt +3 -0
- data/modules/docker_brpm/automations/stop_application_container.rb +11 -0
- data/modules/docker_brpm/automations/stop_application_container.txt +3 -0
- data/modules/docker_brpm/automations/stop_database_container.rb +11 -0
- data/modules/docker_brpm/automations/stop_database_container.txt +3 -0
- data/modules/docker_brpm/automations/test_rest_api.rb +18 -0
- data/modules/docker_brpm/automations/test_rest_api.txt +3 -0
- data/modules/docker_brpm/automations/upgrade_database.rb +19 -0
- data/modules/docker_brpm/automations/upgrade_database.txt +8 -0
- data/modules/docker_brpm/config.yml +8 -0
- data/modules/docker_brpm/lib/docker.rb +39 -0
- data/modules/docker_brpm/lib/git.rb +16 -0
- data/modules/docker_brpm/sample_applications/dockerizedbrpm.json +0 -0
- data/modules/email/automations/send_notification.rb +48 -0
- data/modules/email/automations/send_notification.txt +27 -0
- data/modules/email/config.yml +6 -0
- data/modules/framework/automations/direct_execute.rb +10 -0
- data/modules/framework/automations/direct_execute.txt +16 -0
- data/modules/framework/automations/install_module.rb +13 -0
- data/modules/framework/automations/install_module.txt +16 -0
- data/modules/framework/bin/brpm_install +106 -0
- data/modules/framework/bin/event_handler +63 -0
- data/modules/framework/bin/webhook_receiver +49 -0
- data/modules/framework/brpm_auto.rb +307 -0
- data/modules/framework/brpm_framework.rb +88 -0
- data/modules/framework/brpm_script_executor.rb +146 -0
- data/modules/framework/config.yml +7 -0
- data/modules/framework/config/customer_include.rb +26 -0
- data/modules/framework/config/server.yml +3 -0
- data/modules/framework/customer_include_default.rb +25 -0
- data/modules/framework/lib/logging/brpm_logger.rb +39 -0
- data/modules/framework/lib/logging/logger_base.rb +36 -0
- data/modules/framework/lib/logging/simple_logger.rb +27 -0
- data/modules/framework/lib/params/all_params.rb +80 -0
- data/modules/framework/lib/params/integration_settings.rb +27 -0
- data/modules/framework/lib/params/params.rb +172 -0
- data/modules/framework/lib/params/params_base.rb +81 -0
- data/modules/framework/lib/params/request_params.rb +38 -0
- data/modules/framework/lib/resource_framework.rb +211 -0
- data/modules/framework/lib/rest_api.rb +155 -0
- data/modules/framework/lib/semaphore.rb +79 -0
- data/modules/framework/lib/utilities.rb +317 -0
- data/modules/framework/lib/version_control/git.rb +192 -0
- data/modules/framework/lib/version_control/svn.rb +221 -0
- data/modules/framework/log.html +39 -0
- data/modules/framework/tests/all_params_spec.rb +116 -0
- data/modules/framework/tests/brpm_auto_spec.rb +84 -0
- data/modules/framework/tests/customer_include/config/customer_include.rb +10 -0
- data/modules/framework/tests/customer_include/config/server.yml +3 -0
- data/modules/framework/tests/customer_include_spec.rb +29 -0
- data/modules/framework/tests/local_jirb.rb +15 -0
- data/modules/framework/tests/params_spec.rb +172 -0
- data/modules/framework/tests/request_params_spec.rb +86 -0
- data/modules/framework/tests/server_yaml_spec.rb +19 -0
- data/modules/framework/tests/spec_helper.rb +42 -0
- data/modules/framework/transport/dispatch_baa.rb +355 -0
- data/modules/framework/transport/dispatch_base.rb +345 -0
- data/modules/framework/transport/dispatch_nsh.rb +248 -0
- data/modules/framework/transport/dispatch_ssh.rb +154 -0
- data/modules/framework/transport/transport_baa.rb +1095 -0
- data/modules/framework/transport/transport_nsh.rb +359 -0
- data/modules/framework/transport/transport_ssh.rb +220 -0
- data/modules/framework/write_to.rb +1 -0
- data/modules/jenkins/automations/create_release.rb +4 -0
- data/modules/jenkins/automations/create_release.txt +23 -0
- data/modules/jenkins/automations/f2_downloadJenkinsArtifact.rb +126 -0
- data/modules/jenkins/config.yml +7 -0
- data/modules/jenkins/lib/jenkins.rb +300 -0
- data/modules/jenkins/resource_automations/f2_rsc_jenkinsJobs.rb +58 -0
- data/modules/jira/automations/add_comment.rb +4 -0
- data/modules/jira/automations/add_comment.txt +23 -0
- data/modules/jira/automations/create_release.rb +4 -0
- data/modules/jira/automations/create_release.txt +23 -0
- data/modules/jira/automations/delete_release.rb +4 -0
- data/modules/jira/automations/delete_release.txt +23 -0
- data/modules/jira/automations/transition_issue.rb +4 -0
- data/modules/jira/automations/transition_issue.txt +23 -0
- data/modules/jira/automations/transition_issues_for_request.rb +29 -0
- data/modules/jira/automations/transition_issues_for_request.txt +20 -0
- data/modules/jira/automations/transition_issues_for_run.rb +26 -0
- data/modules/jira/automations/transition_issues_for_run.txt +20 -0
- data/modules/jira/automations/update_release.rb +4 -0
- data/modules/jira/automations/update_release.txt +26 -0
- data/modules/jira/config.yml +7 -0
- data/modules/jira/lib/jira_rest_client.rb +185 -0
- data/modules/jira/tests/create_read_update_delete_release_spec.rb +39 -0
- data/modules/jira/tests/spec_helper.rb +39 -0
- data/modules/jira/tests/transition_issue_spec.rb +32 -0
- data/modules/patch_process_management/automations/execute_job/script.rb +105 -0
- data/modules/patch_process_management/automations/execute_job/wrapper.txt +39 -0
- data/modules/patch_process_management/automations/patch_analysis/script.rb +107 -0
- data/modules/patch_process_management/automations/patch_analysis/wrapper.txt +33 -0
- data/modules/patch_process_management/automations/patch_readiness/script.rb +89 -0
- data/modules/patch_process_management/automations/patch_readiness/wrapper.txt +33 -0
- data/modules/patch_process_management/automations/patch_remediation/script.rb +217 -0
- data/modules/patch_process_management/automations/patch_remediation/wrapper.txt +40 -0
- data/modules/patch_process_management/config.yml +10 -0
- data/modules/teamcity/automations/trigger_build.rb +4 -0
- data/modules/teamcity/automations/trigger_build.txt +14 -0
- data/modules/teamcity/config.yml +7 -0
- data/modules/teamcity/lib/teamcity_rest_client.rb +17 -0
- data/modules/teamcity/tests/spec_helper.rb +34 -0
- data/modules/teamcity/tests/trigger_build_spec.rb +27 -0
- data/modules/windows/automations/deploy_directory_over_windows_shares/script.rb +87 -0
- data/modules/windows/automations/deploy_directory_over_windows_shares/wrapper.txt +29 -0
- data/modules/windows/automations/deploy_file_over_windows_shares/script.rb +31 -0
- data/modules/windows/automations/deploy_file_over_windows_shares/wrapper.txt +24 -0
- data/modules/windows/config.yml +6 -0
- data/modules/windows/lib/samba.rb +29 -0
- metadata +397 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe 'create/update/delete release' do
|
4
|
+
before(:all) do
|
5
|
+
setup_brpm_auto
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
cleanup_release('JIRA tests - release 1')
|
10
|
+
cleanup_release('JIRA tests - release 1 - updated')
|
11
|
+
end
|
12
|
+
|
13
|
+
describe '' do
|
14
|
+
it 'should create/update/delete release in jira' do
|
15
|
+
params = get_default_params
|
16
|
+
params = params.merge(get_integration_params_for_jira)
|
17
|
+
|
18
|
+
params["release_name"] = 'JIRA tests - release 1'
|
19
|
+
BrpmScriptExecutor.execute_automation_script("jira", "create_release", params)
|
20
|
+
|
21
|
+
option = @jira_rest_client.get_option_for_dropdown_custom_field(params["jira_release_field_id"], 'JIRA tests - release 1')
|
22
|
+
expect(option).not_to be_nil
|
23
|
+
|
24
|
+
params["old_release_name"] = 'JIRA tests - release 1'
|
25
|
+
params["new_release_name"] = 'JIRA tests - release 1 - updated'
|
26
|
+
BrpmScriptExecutor.execute_automation_script("jira", "update_release", params)
|
27
|
+
|
28
|
+
option = @jira_rest_client.get_option_for_dropdown_custom_field(params["jira_release_field_id"], 'JIRA tests - release 1 - updated')
|
29
|
+
expect(option).not_to be_nil
|
30
|
+
|
31
|
+
params["release_name"] = 'JIRA tests - release 1 - updated'
|
32
|
+
BrpmScriptExecutor.execute_automation_script("jira", "delete_release", params)
|
33
|
+
|
34
|
+
option = @jira_rest_client.get_option_for_dropdown_custom_field(params["jira_release_field_id"], 'JIRA tests - release 1 - updated')
|
35
|
+
expect(option).to be_nil
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require_relative "../../framework/brpm_script_executor"
|
3
|
+
|
4
|
+
def setup_brpm_auto
|
5
|
+
FileUtils.mkdir_p "/tmp/brpm_content"
|
6
|
+
|
7
|
+
BrpmAuto.setup( get_default_params.merge!(get_integration_params_for_jira) )
|
8
|
+
|
9
|
+
BrpmAuto.require_module "jira"
|
10
|
+
|
11
|
+
@jira_rest_client = JiraRestClient.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_default_params
|
15
|
+
params = {}
|
16
|
+
params['also_log_to_console'] = 'true'
|
17
|
+
|
18
|
+
params['brpm_url'] = 'http://brpm-content.pulsar-it.be:8088/brpm'
|
19
|
+
params['brpm_api_token'] = ENV["BRPM_API_TOKEN"]
|
20
|
+
|
21
|
+
params['output_dir'] = "/tmp/brpm_content"
|
22
|
+
|
23
|
+
params
|
24
|
+
end
|
25
|
+
|
26
|
+
def get_integration_params_for_jira
|
27
|
+
params = {}
|
28
|
+
params["SS_integration_dns"] = 'http://brpm.pulsar-it.be:9090'
|
29
|
+
params["SS_integration_username"] = 'brpm'
|
30
|
+
params["SS_integration_password"] = ENV["JIRA_PASSWORD"]
|
31
|
+
|
32
|
+
params["jira_release_field_id"] = '10000'
|
33
|
+
|
34
|
+
params
|
35
|
+
end
|
36
|
+
|
37
|
+
def cleanup_release(release_name)
|
38
|
+
@jira_rest_client.delete_option_for_dropdown_custom_field('10000', release_name)
|
39
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe 'transition issue' do
|
4
|
+
before(:all) do
|
5
|
+
setup_brpm_auto
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
end
|
10
|
+
|
11
|
+
describe '' do
|
12
|
+
it 'transition an issue in JIRA' do
|
13
|
+
params = get_default_params
|
14
|
+
params = params.merge(get_integration_params_for_jira)
|
15
|
+
|
16
|
+
params["issue_id"] = "EF-25"
|
17
|
+
|
18
|
+
params["target_issue_status"] = "Done"
|
19
|
+
BrpmScriptExecutor.execute_automation_script("jira", "transition_issue", params)
|
20
|
+
|
21
|
+
params["target_issue_status"] = "To Do"
|
22
|
+
BrpmScriptExecutor.execute_automation_script("jira", "transition_issue", params)
|
23
|
+
|
24
|
+
params["target_issue_status"] = "In development"
|
25
|
+
BrpmScriptExecutor.execute_automation_script("jira", "transition_issue", params)
|
26
|
+
|
27
|
+
params["target_issue_status"] = "Deployed to development"
|
28
|
+
BrpmScriptExecutor.execute_automation_script("jira", "transition_issue", params)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'base64'
|
2
|
+
require 'csv'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
def pack_response_for_result_summaries(csv_content)
|
6
|
+
logs = csv_content[6..-1] # remove the headers of the csv file
|
7
|
+
|
8
|
+
logs = logs.select { |log| !log[0].start_with?("Run at") }
|
9
|
+
|
10
|
+
logs.each do |log|
|
11
|
+
log[2] = DateTime.parse(log[2])
|
12
|
+
end
|
13
|
+
|
14
|
+
logs = logs.sort_by { |log| [log[0], log[2]] }
|
15
|
+
|
16
|
+
servers_with_logs = logs.group_by {|log| log[0] }
|
17
|
+
failed_servers_with_logs = servers_with_logs.select {|key, value| value.select{|log| log[1] == "Error"}.count>0}
|
18
|
+
|
19
|
+
pack_response "results_summary", "#{servers_with_logs.count - failed_servers_with_logs.count}/#{servers_with_logs.count} servers were successful"
|
20
|
+
|
21
|
+
table_data = [[' ', 'Server', 'Result', 'Error message']]
|
22
|
+
counter = 0
|
23
|
+
server_cache = ""
|
24
|
+
logs.select{|log| log[1] == "Error"}.each do |log|
|
25
|
+
if log[0] == server_cache
|
26
|
+
server = ""
|
27
|
+
else
|
28
|
+
server = log[0]
|
29
|
+
server_cache = log[0]
|
30
|
+
end
|
31
|
+
result = log[1]
|
32
|
+
message = log[3]
|
33
|
+
|
34
|
+
counter += 1
|
35
|
+
table_data << [counter, server, result, message]
|
36
|
+
end
|
37
|
+
|
38
|
+
pack_response "failed_servers", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
|
39
|
+
end
|
40
|
+
|
41
|
+
brpm_rest_client = BrpmRestClient.new
|
42
|
+
params = BrpmAuto.params
|
43
|
+
|
44
|
+
BrpmAuto.log("Getting the server group from the step...")
|
45
|
+
server_group = "/#{get_server_group_from_step_id(params["step_id"])}"
|
46
|
+
|
47
|
+
job_type_and_name = params["job_type_and_name"].split("|")
|
48
|
+
job_type = job_type_and_name[0]
|
49
|
+
job_name = job_type_and_name[1]
|
50
|
+
raise "Could not find out the job key or job name." unless job_type_and_name.count == 2
|
51
|
+
|
52
|
+
job_group = "/#{params["application"].downcase}/public/#{job_type}"
|
53
|
+
BrpmAuto.log("The job to be executed is #{job_group}/#{job_name}")
|
54
|
+
|
55
|
+
BrpmAuto.log("Logging on to Bladelogic instance #{BsaSoapClient.get_url} with user #{BsaSoapClient.get_username} and role #{BsaSoapClient.get_role}...")
|
56
|
+
session_id = BsaSoapClient.login
|
57
|
+
|
58
|
+
BrpmAuto.log("Retrieving the job key of the job...")
|
59
|
+
job_db_key = Object.const_get(job_type).get_dbkey_by_group_and_name(session_id, {:group_name => job_group, :job_name => job_name})
|
60
|
+
BrpmAuto.log("Job key is #{job_db_key}.")
|
61
|
+
|
62
|
+
# BrpmAuto.log("Cleaning the servers from the job...")
|
63
|
+
# job_db_key = Job.clear_target_servers(session_id, {:job_key => job_db_key})
|
64
|
+
|
65
|
+
# BrpmAuto.log("Cleaning the server groups from the job...")
|
66
|
+
# job_db_key = Job.clear_target_groups(session_id, {:job_key => job_db_key})
|
67
|
+
|
68
|
+
BrpmAuto.log("Executing the job on server group #{server_group}...")
|
69
|
+
job_run_key = Job.execute_against_server_groups_for_run_id(session_id, {:job_key => job_db_key, :server_groups => server_group})
|
70
|
+
BrpmAuto.log("Job run is #{job_run_key}.")
|
71
|
+
|
72
|
+
BrpmAuto.log("Polling the job until it is finished...")
|
73
|
+
begin
|
74
|
+
sleep(10)
|
75
|
+
is_still_running = JobRun.get_job_run_is_running_by_run_key(session_id, {:job_run_key => job_run_key})
|
76
|
+
end while is_still_running
|
77
|
+
BrpmAuto.log("The job has finished.")
|
78
|
+
|
79
|
+
BrpmAuto.log("Checking if the job finished successfully...")
|
80
|
+
had_errors = JobRun.get_job_run_had_errors(session_id, {:job_run_key => job_run_key})
|
81
|
+
|
82
|
+
had_errors ? BrpmAuto.log("WARNING: The job had errors!") : BrpmAuto.log("The job had no errors.")
|
83
|
+
pack_response "job_status", had_errors ? "The job had errors" : "The job ran successfully"
|
84
|
+
|
85
|
+
BrpmAuto.log("Retrieving the job run id from the job run key...")
|
86
|
+
job_run_id = JobRun.job_run_key_to_job_run_id(session_id, {:job_run_key => job_run_key})
|
87
|
+
|
88
|
+
BrpmAuto.log("Retrieving the results from the job run id...")
|
89
|
+
results_full_path = "#{params["SS_output_dir"]}/#{job_name}_result.csv"
|
90
|
+
return_data = Utility.export_nsh_script_run(session_id, {
|
91
|
+
:run_id => job_run_id,
|
92
|
+
:export_file_name => results_full_path})
|
93
|
+
results_content = Base64.decode64(return_data)
|
94
|
+
|
95
|
+
File.open(results_full_path, "w") do |f|
|
96
|
+
f.puts(results_content)
|
97
|
+
end
|
98
|
+
|
99
|
+
csv_content = CSV.parse(results_content)
|
100
|
+
|
101
|
+
pack_response_for_result_summaries(csv_content)
|
102
|
+
|
103
|
+
pack_response "results_link", results_full_path
|
104
|
+
|
105
|
+
raise "The job had errors!" if had_errors
|
@@ -0,0 +1,39 @@
|
|
1
|
+
###
|
2
|
+
# job_type_and_name:
|
3
|
+
# name: Job
|
4
|
+
# position: A1:E1
|
5
|
+
# type: in-external-single-select
|
6
|
+
# external_resource: select_job
|
7
|
+
# required: yes
|
8
|
+
# job_status:
|
9
|
+
# name: Job Status
|
10
|
+
# type: out-text
|
11
|
+
# position: A1:C1
|
12
|
+
# results_summary:
|
13
|
+
# name: Summary
|
14
|
+
# type: out-text
|
15
|
+
# position: A2:E2
|
16
|
+
# failed_servers:
|
17
|
+
# name: Failed servers
|
18
|
+
# type: out-table
|
19
|
+
# position: A3:E3
|
20
|
+
# results_link:
|
21
|
+
# name: Link
|
22
|
+
# type: out-file
|
23
|
+
# position: A4:E4
|
24
|
+
###
|
25
|
+
|
26
|
+
#=== BMC Application Automation Integration Server: BladeLogic on C4 ===#
|
27
|
+
# [integration_id=6]
|
28
|
+
#=== End ===#
|
29
|
+
|
30
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
31
|
+
|
32
|
+
params["direct_execute"] = true
|
33
|
+
|
34
|
+
params["SS_integration_dns"] = SS_integration_dns
|
35
|
+
params["SS_integration_username"] = SS_integration_username
|
36
|
+
params["SS_integration_password_enc"] = SS_integration_password_enc
|
37
|
+
params["SS_integration_details"] = YAML.load(SS_integration_details)
|
38
|
+
|
39
|
+
BrpmScriptExecutor.execute_automation_script("patch_process_management", "execute_job", params)
|
@@ -0,0 +1,107 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'uri'
|
3
|
+
require 'base64'
|
4
|
+
require 'csv'
|
5
|
+
|
6
|
+
def extract_table_data(csv_content)
|
7
|
+
patches = csv_content[12..-1] # remove the headers of the csv file
|
8
|
+
|
9
|
+
patches = patches.sort_by { |patch| [patch[1], patch[2]] }
|
10
|
+
|
11
|
+
table_data = [[' ', 'Server', 'Package']]
|
12
|
+
counter = 0
|
13
|
+
server_cache = ""
|
14
|
+
|
15
|
+
patches.each do |patch|
|
16
|
+
if patch[1] == server_cache
|
17
|
+
server = ""
|
18
|
+
else
|
19
|
+
server = patch[1]
|
20
|
+
server_cache = patch[1]
|
21
|
+
end
|
22
|
+
|
23
|
+
if patch[0] == "Failed"
|
24
|
+
package = "Failed"
|
25
|
+
elsif patch[2] == "NO-PATCH-MISSING"
|
26
|
+
package = "Already up-to-date"
|
27
|
+
else
|
28
|
+
package = patch[2]
|
29
|
+
end
|
30
|
+
|
31
|
+
counter += 1
|
32
|
+
table_data << [counter, server, package]
|
33
|
+
end
|
34
|
+
return table_data
|
35
|
+
end
|
36
|
+
|
37
|
+
brpm_rest_client = BrpmRestClient.new
|
38
|
+
params = BrpmAuto.params
|
39
|
+
|
40
|
+
BrpmAuto.log("Getting the server group from the step...")
|
41
|
+
server_group = "/#{get_server_group_from_step_id(params["step_id"])}"
|
42
|
+
|
43
|
+
patch_analysis_job_group = "/patch-process-management"
|
44
|
+
patch_analysis_job_name = "analysis-job"
|
45
|
+
|
46
|
+
BrpmAuto.log("Logging on to Bladelogic instance #{BsaSoapClient.get_url} with user #{BsaSoapClient.get_username} and role #{BsaSoapClient.get_role}...")
|
47
|
+
session_id = BsaSoapClient.login
|
48
|
+
|
49
|
+
BrpmAuto.log("Retrieving the job key of Patch Analysis job #{patch_analysis_job_group}/#{patch_analysis_job_name}...")
|
50
|
+
job_db_key = PatchingJob.get_dbkey_by_group_and_name(session_id, {:group_name => patch_analysis_job_group, :job_name => patch_analysis_job_name})
|
51
|
+
BrpmAuto.log("Job key is #{job_db_key}.")
|
52
|
+
|
53
|
+
# BrpmAuto.log("Cleaning the servers from the Patch Analysis job...")
|
54
|
+
# job_db_key = Job.clear_target_servers(session_id, {:job_key => job_db_key})
|
55
|
+
|
56
|
+
# BrpmAuto.log("Cleaning the server groups from the Patch Analysis job...")
|
57
|
+
# job_db_key = Job.clear_target_groups(session_id, {:job_key => job_db_key})
|
58
|
+
|
59
|
+
BrpmAuto.log("Executing the Patch Analysis job on server group #{server_group}...")
|
60
|
+
job_run_key = Job.execute_against_server_groups_for_run_id(session_id, {:job_key => job_db_key, :server_groups => server_group})
|
61
|
+
BrpmAuto.log("Job run is #{job_run_key}.")
|
62
|
+
|
63
|
+
BrpmAuto.log("Polling the Patch Analysis job until it is finished...")
|
64
|
+
begin
|
65
|
+
sleep(10)
|
66
|
+
is_still_running = JobRun.get_job_run_is_running_by_run_key(session_id, {:job_run_key => job_run_key})
|
67
|
+
end while is_still_running
|
68
|
+
BrpmAuto.log("The Patch Analysis job has finished.")
|
69
|
+
|
70
|
+
BrpmAuto.log("Checking if the Patch Analysis job finished successfully...")
|
71
|
+
had_errors = JobRun.get_job_run_had_errors(session_id, {:job_run_key => job_run_key})
|
72
|
+
|
73
|
+
had_errors ? BrpmAuto.log("WARNING: The Patch Analysis job had errors!") : BrpmAuto.log("The Patch Analysis job had no errors.")
|
74
|
+
pack_response "job_status", had_errors ? "The job had errors" : "The job ran successfully"
|
75
|
+
|
76
|
+
BrpmAuto.log("Storing the job key and job run key of the Patch Analysis job for later reference...")
|
77
|
+
add_request_param("patch_analysis_job_db_key", job_db_key)
|
78
|
+
add_request_param("patch_analysis_job_run_key", job_run_key)
|
79
|
+
|
80
|
+
BrpmAuto.log("Retrieving the job run id from the job run key...")
|
81
|
+
job_run_id = JobRun.job_run_key_to_job_run_id(session_id, {:job_run_key => job_run_key})
|
82
|
+
|
83
|
+
BrpmAuto.log("Retrieving the results from the job run id...")
|
84
|
+
results_full_path = "#{params["SS_output_dir"]}/#{patch_analysis_job_name}_result.csv"
|
85
|
+
return_data = Utility.export_patch_analysis_run(session_id, {
|
86
|
+
:server_name => "",
|
87
|
+
:job_group_name => patch_analysis_job_group,
|
88
|
+
:job_name => patch_analysis_job_name,
|
89
|
+
:run_id => job_run_id,
|
90
|
+
:export_file_name => results_full_path,
|
91
|
+
:export_type => "CSV"})
|
92
|
+
results_content = Base64.decode64(return_data)
|
93
|
+
|
94
|
+
File.open(results_full_path, "w") do |f|
|
95
|
+
f.puts(results_content)
|
96
|
+
end
|
97
|
+
|
98
|
+
csv_content = CSV.parse(results_content)
|
99
|
+
|
100
|
+
pack_response "results_summary", "#{csv_content[4][1]} RPM's missing, #{csv_content[5][1]} Errata's missing, #{csv_content[7][1]}/#{csv_content[6][1].to_i + csv_content[7][1].to_i} servers were analyzed successfully"
|
101
|
+
|
102
|
+
table_data = extract_table_data(csv_content)
|
103
|
+
|
104
|
+
pack_response "results", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
|
105
|
+
pack_response "results_link", results_full_path
|
106
|
+
|
107
|
+
raise "The Patch Analysis job had errors!" if had_errors
|
@@ -0,0 +1,33 @@
|
|
1
|
+
###
|
2
|
+
# job_status:
|
3
|
+
# name: Job Status
|
4
|
+
# type: out-text
|
5
|
+
# position: A1:C1
|
6
|
+
# results_summary:
|
7
|
+
# name: Summary
|
8
|
+
# type: out-text
|
9
|
+
# position: A2:E2
|
10
|
+
# results:
|
11
|
+
# name: Patches
|
12
|
+
# type: out-table
|
13
|
+
# position: A3:E3
|
14
|
+
# results_link:
|
15
|
+
# name: Link
|
16
|
+
# type: out-file
|
17
|
+
# position: A4:E4
|
18
|
+
###
|
19
|
+
|
20
|
+
#=== BMC Application Automation Integration Server: BladeLogic on C4 ===#
|
21
|
+
# [integration_id=6]
|
22
|
+
#=== End ===#
|
23
|
+
|
24
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
25
|
+
|
26
|
+
params["direct_execute"] = true
|
27
|
+
|
28
|
+
params["SS_integration_dns"] = SS_integration_dns
|
29
|
+
params["SS_integration_username"] = SS_integration_username
|
30
|
+
params["SS_integration_password_enc"] = SS_integration_password_enc
|
31
|
+
params["SS_integration_details"] = YAML.load(SS_integration_details)
|
32
|
+
|
33
|
+
BrpmScriptExecutor.execute_automation_script("patch_process_management", "patch_analysis", params)
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'uri'
|
3
|
+
require 'base64'
|
4
|
+
require 'csv'
|
5
|
+
|
6
|
+
def extract_table_data(csv_content)
|
7
|
+
checks = csv_content[14..-1] # remove the headers of the csv file
|
8
|
+
|
9
|
+
checks = checks.sort_by { |check| check[1] }
|
10
|
+
|
11
|
+
table_data = [[' ', 'Server', 'Rule', 'Result', 'Error message']]
|
12
|
+
counter = 0
|
13
|
+
checks.each do |check|
|
14
|
+
server = check[1]
|
15
|
+
rule = check[4]
|
16
|
+
result = check[8]
|
17
|
+
error_message = check[9]
|
18
|
+
counter += 1
|
19
|
+
table_data << [counter, server, rule, result, error_message]
|
20
|
+
end
|
21
|
+
return table_data
|
22
|
+
end
|
23
|
+
|
24
|
+
brpm_rest_client = BrpmRestClient.new
|
25
|
+
params = BrpmAuto.params
|
26
|
+
|
27
|
+
BrpmAuto.log("Getting the server group from the step...")
|
28
|
+
server_group = "/#{get_server_group_from_step_id(params["step_id"])}"
|
29
|
+
|
30
|
+
patch_readiness_job_group = "/patch-process-management"
|
31
|
+
patch_readiness_job_name = "readiness-job"
|
32
|
+
|
33
|
+
BrpmAuto.log("Logging on to Bladelogic instance #{BsaSoapClient.get_url} with user #{BsaSoapClient.get_username} and role #{BsaSoapClient.get_role}...")
|
34
|
+
session_id = BsaSoapClient.login
|
35
|
+
|
36
|
+
BrpmAuto.log("Retrieving the job key of Patch Readiness job #{patch_readiness_job_group}/#{patch_readiness_job_name}...")
|
37
|
+
job_db_key = ComplianceJob.get_dbkey_by_group_and_name(session_id, {:group_name => patch_readiness_job_group, :job_name => patch_readiness_job_name})
|
38
|
+
BrpmAuto.log("Job key is #{job_db_key}.")
|
39
|
+
|
40
|
+
# BrpmAuto.log("Cleaning the servers from the Patch Readiness job...")
|
41
|
+
# job_db_key = Job.clear_target_servers(session_id, {:job_key => job_db_key})
|
42
|
+
|
43
|
+
# BrpmAuto.log("Cleaning the server groups from the Patch Readiness job...")
|
44
|
+
# job_db_key = Job.clear_target_groups(session_id, {:job_key => job_db_key})
|
45
|
+
|
46
|
+
BrpmAuto.log("Executing the Patch Readiness job on server group #{server_group}...")
|
47
|
+
job_run_key = Job.execute_against_server_groups_for_run_id(session_id, {:job_key => job_db_key, :server_groups => server_group})
|
48
|
+
BrpmAuto.log("Job run is #{job_run_key}.")
|
49
|
+
|
50
|
+
BrpmAuto.log("Polling the Patch Readiness job until it is finished...")
|
51
|
+
begin
|
52
|
+
sleep(10)
|
53
|
+
is_still_running = JobRun.get_job_run_is_running_by_run_key(session_id, {:job_run_key => job_run_key})
|
54
|
+
end while is_still_running
|
55
|
+
BrpmAuto.log("The Patch Readiness job has finished.")
|
56
|
+
|
57
|
+
BrpmAuto.log("Checking if the Patch Readiness job finished successfully...")
|
58
|
+
had_errors = JobRun.get_job_run_had_errors(session_id, {:job_run_key => job_run_key})
|
59
|
+
|
60
|
+
had_errors ? BrpmAuto.log("WARNING: The Patch Readiness job had errors!") : BrpmAuto.log("The Patch Readiness job had no errors.")
|
61
|
+
pack_response "job_status", had_errors ? "The job had errors" : "The job ran successfully"
|
62
|
+
|
63
|
+
BrpmAuto.log("Retrieving the job run id from the job run key...")
|
64
|
+
job_run_id = JobRun.job_run_key_to_job_run_id(session_id, {:job_run_key => job_run_key})
|
65
|
+
|
66
|
+
BrpmAuto.log("Retrieving the results from the job run id...")
|
67
|
+
results_full_path = "#{params["SS_output_dir"]}/#{patch_readiness_job_name}_result.csv"
|
68
|
+
return_data = Utility.export_compliance_run(session_id, {
|
69
|
+
:job_group_name => patch_readiness_job_group,
|
70
|
+
:job_name => patch_readiness_job_name,
|
71
|
+
:run_id => job_run_id,
|
72
|
+
:export_file_name => results_full_path,
|
73
|
+
:export_type => "CSV"})
|
74
|
+
results_content = Base64.decode64(return_data)
|
75
|
+
|
76
|
+
File.open(results_full_path, "w") do |f|
|
77
|
+
f.puts(results_content)
|
78
|
+
end
|
79
|
+
|
80
|
+
csv_content = CSV.parse(results_content)
|
81
|
+
|
82
|
+
pack_response "results_summary", "#{csv_content[7][1]} / #{csv_content[6][1]} rules passed"
|
83
|
+
|
84
|
+
table_data = extract_table_data(csv_content)
|
85
|
+
|
86
|
+
pack_response "results", { :perPage => 10, :totalItems => table_data.count - 1, :data => table_data }
|
87
|
+
pack_response "results_link", results_full_path
|
88
|
+
|
89
|
+
raise "The Patch Readiness job had errors!" if had_errors
|