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,53 @@
|
|
1
|
+
###
|
2
|
+
# depot_group_path:
|
3
|
+
# name: Depot group path
|
4
|
+
# position: A1:F1
|
5
|
+
# bl_package_name:
|
6
|
+
# name: Bladelogic package name
|
7
|
+
# position: A2:D2
|
8
|
+
# deploy_job_group_path:
|
9
|
+
# name: Deploy job group path
|
10
|
+
# position: A3:F3
|
11
|
+
# deploy_job_name:
|
12
|
+
# name: Deploy job name
|
13
|
+
# position: A4:D4
|
14
|
+
# target_type:
|
15
|
+
# name: Target type
|
16
|
+
# type: in-list-single
|
17
|
+
# list_pairs: 0,Server group|1,Component group
|
18
|
+
# position: A5:C5
|
19
|
+
# target_path:
|
20
|
+
# name: Target path
|
21
|
+
# position: A6:F6
|
22
|
+
# job_status:
|
23
|
+
# name: Job Status
|
24
|
+
# type: out-text
|
25
|
+
# position: A1:C1
|
26
|
+
# results_summary:
|
27
|
+
# name: Summary
|
28
|
+
# type: out-text
|
29
|
+
# position: A2:E2
|
30
|
+
# results:
|
31
|
+
# name: Installs
|
32
|
+
# type: out-table
|
33
|
+
# position: A3:E3
|
34
|
+
# results_link:
|
35
|
+
# name: Link
|
36
|
+
# type: out-file
|
37
|
+
# position: A4:E4
|
38
|
+
###
|
39
|
+
|
40
|
+
#=== BMC Application Automation Integration Server: BladeLogic on aws ===#
|
41
|
+
# [integration_id=6]
|
42
|
+
#=== End ===#
|
43
|
+
|
44
|
+
require "#{params["SS_script_support_path"]}/git_repos/brpm_content/modules/framework/brpm_script_executor.rb"
|
45
|
+
|
46
|
+
params["direct_execute"] = true
|
47
|
+
|
48
|
+
params["SS_integration_dns"] = SS_integration_dns
|
49
|
+
params["SS_integration_username"] = SS_integration_username
|
50
|
+
params["SS_integration_password_enc"] = SS_integration_password_enc
|
51
|
+
params["SS_integration_details"] = YAML.load(SS_integration_details)
|
52
|
+
|
53
|
+
BrpmScriptExecutor.execute_automation_script("bladelogic", "deploy_package", params)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
class BsaRestClient
|
2
|
+
def initialize(integration_settings = BrpmAuto.integration_settings)
|
3
|
+
@url = integration_settings.dns
|
4
|
+
@username = integration_settings.username
|
5
|
+
@password = integration_settings.password
|
6
|
+
@role = integration_settings.details["role"]
|
7
|
+
|
8
|
+
@api_url = "#{@url}/rest/api/2"
|
9
|
+
end
|
10
|
+
|
11
|
+
def get_component_by_name(component_name)
|
12
|
+
result = run_query("SELECT * FROM \"SystemObject/Component\" WHERE NAME equals \"#{component_name}\"")
|
13
|
+
|
14
|
+
raise "BSA component '#{component_name}' not found" if result.empty?
|
15
|
+
|
16
|
+
result[0]
|
17
|
+
end
|
18
|
+
|
19
|
+
def run_query(query)
|
20
|
+
path = "query?bquery=#{query}"
|
21
|
+
|
22
|
+
BrpmAuto.log "Running query #{path}..."
|
23
|
+
result = bl_get(path)
|
24
|
+
response = result["response"]
|
25
|
+
|
26
|
+
if response.has_key? "ErrorResponse"
|
27
|
+
raise "#{response["ErrorResponse"]["Error"]}"
|
28
|
+
end
|
29
|
+
|
30
|
+
if response["PropertySetClassChildrenResponse"] && response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]
|
31
|
+
unless response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]["PropertySetInstances"]["Elements"].empty?
|
32
|
+
return response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]["PropertySetInstances"]["Elements"]
|
33
|
+
end
|
34
|
+
unless response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]["Groups"]["Elements"].empty?
|
35
|
+
return response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]["Groups"]["Elements"]
|
36
|
+
end
|
37
|
+
unless response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]["PropertySetClasses"]["Elements"].empty?
|
38
|
+
return response["PropertySetClassChildrenResponse"]["PropertySetClassChildren"]["PropertySetClasses"]["Elements"]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
[]
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def add_credentials(path)
|
47
|
+
path + (path.include?("?") ? "&" : "?") + "username=#{@username}&password=#{@password}&role=#{@role}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def bl_get(path, options = {})
|
51
|
+
Rest.get("#{@url}/#{add_credentials(path)}", options)
|
52
|
+
end
|
53
|
+
|
54
|
+
def bl_post(path, data, options = {})
|
55
|
+
Rest.post("#{@url}/#{add_credentials(path)}", data, options)
|
56
|
+
end
|
57
|
+
|
58
|
+
def bl_put(path, data, options = {})
|
59
|
+
Rest.put("#{@url}/#{add_credentials(path)}", data, options)
|
60
|
+
end
|
61
|
+
|
62
|
+
def bl_delete(path, options = {})
|
63
|
+
Rest.delete("#{@url}/#{add_credentials(path)}", options)
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
class BlPackage < BsaSoapBase
|
2
|
+
def create_package_from_component(options = {})
|
3
|
+
validate_cli_options_hash([:package_name, :depot_group_id, :component_key], options)
|
4
|
+
integer_result = execute_cli_with_param_list(self.class, "createPackageFromComponent",
|
5
|
+
[
|
6
|
+
options[:package_name],
|
7
|
+
options[:depot_group_id],
|
8
|
+
false, #bSoftLinked
|
9
|
+
false, #bCollectFileAcl
|
10
|
+
false, #bCollectFileAttributes
|
11
|
+
true, #bCopyFileContents
|
12
|
+
false, #bCollectRegistryAcl
|
13
|
+
options[:component_key]
|
14
|
+
])
|
15
|
+
integer_value = get_cli_return_value(integer_result)
|
16
|
+
rescue => exception
|
17
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete_blpackage_by_group_and_name(options = {})
|
21
|
+
validate_cli_options_hash([:parent_group, :package_name], options)
|
22
|
+
integer_result = execute_cli_with_param_list(self.class, "deleteBlPackageByGroupAndName",
|
23
|
+
[
|
24
|
+
options[:parent_group],
|
25
|
+
options[:package_name],
|
26
|
+
])
|
27
|
+
integer_value = get_cli_return_value(integer_result)
|
28
|
+
rescue => exception
|
29
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
30
|
+
end
|
31
|
+
|
32
|
+
def get_dbkey_by_group_and_name(options = {})
|
33
|
+
validate_cli_options_hash([:parent_group, :depot_group_path], options)
|
34
|
+
integer_result = execute_cli_with_param_list(self.class, "getDBKeyByGroupAndName",
|
35
|
+
[
|
36
|
+
options[:parent_group],
|
37
|
+
options[:depot_group_path],
|
38
|
+
])
|
39
|
+
integer_value = get_cli_return_value(integer_result)
|
40
|
+
rescue => exception
|
41
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'savon'
|
2
|
+
|
3
|
+
class BsaSoapBase
|
4
|
+
# Filter out password data when logging enabled
|
5
|
+
HTTPI.log = false
|
6
|
+
Savon.configure do |config|
|
7
|
+
config._logger.filter << :password
|
8
|
+
config.log = false
|
9
|
+
end
|
10
|
+
|
11
|
+
# Module Constants
|
12
|
+
HTTP_READ_TIMEOUT = 300
|
13
|
+
DEFAULT_AUTH_TYPE = "SRP"
|
14
|
+
LOGIN_WSDL = "/services/BSALoginService.wsdl"
|
15
|
+
ROLE_WSDL = "/services/BSAAssumeRoleService.wsdl"
|
16
|
+
CLI_WSDL = "/services/BSACLITunnelService.wsdl"
|
17
|
+
LOGIN_SERVICE = "/services/LoginService"
|
18
|
+
ROLE_SERVICE = "/services/AssumeRoleService"
|
19
|
+
CLI_SERVICE = "/services/CLITunnelService"
|
20
|
+
|
21
|
+
def initialize(url, session_id)
|
22
|
+
@url = url
|
23
|
+
@session_id = session_id
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate_cli_options_hash(required_keys, options)
|
27
|
+
required_keys.each { |key| raise "Invalid options hash(missing #{key}) for command, cannot continue" unless options.has_key?(key) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate_cli_option_hash_string_values(supported_values, options_key)
|
31
|
+
supported_values.any? {
|
32
|
+
|value| raise "options key value(#{options_value}) not supported" unless options_key.eql?(value)
|
33
|
+
}
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_all_servers(server_group)
|
37
|
+
result = execute_cli_with_param_list("Server", "listServersInGroup", [server_group])
|
38
|
+
servers = get_cli_return_value(result)
|
39
|
+
rescue => exception
|
40
|
+
raise "Failed to get all servers for #{server_group}: #{exception.to_s}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def validate_servers(servers = [])
|
44
|
+
error = {}
|
45
|
+
servers.each do |server|
|
46
|
+
result = execute_cli_with_param_list("Server", "printPropertyValue", [server, "AGENT_STATUS"])
|
47
|
+
if result[:success] == false || result[:return_value] != "agent is alive"
|
48
|
+
error[:"#{server}"] = "cannot validate server status"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
if error.length > 0
|
52
|
+
raise "Problem validating server: #{error}"
|
53
|
+
end
|
54
|
+
rescue => exception
|
55
|
+
raise "Failed to validate server: #{exception.to_s}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def validate_cli_result(result)
|
59
|
+
if result && (result.is_a? Hash)
|
60
|
+
if result[:success] == false
|
61
|
+
raise "Command execution failed: #{result[:error]}, #{result[:comments]}"
|
62
|
+
end
|
63
|
+
return result
|
64
|
+
else
|
65
|
+
raise "Command execution did not return a valid response: #{result.inspect}"
|
66
|
+
end
|
67
|
+
nil
|
68
|
+
end
|
69
|
+
|
70
|
+
def get_cli_return_value(result)
|
71
|
+
if result && result.is_a?(Hash) && result.has_key?(:success) && result[:success]
|
72
|
+
return result[:return_value]
|
73
|
+
end
|
74
|
+
nil
|
75
|
+
end
|
76
|
+
|
77
|
+
def execute_cli_with_attachments(namespace, command, args, payload)
|
78
|
+
BrpmAuto.log("blcli #{namespace} #{command} #{args.join(" ")}")
|
79
|
+
|
80
|
+
client = Savon.client("#{@url}#{CLI_WSDL}") do |wsdl, http|
|
81
|
+
http.auth.ssl.verify_mode = :none
|
82
|
+
end
|
83
|
+
client.http.read_timeout = HTTP_READ_TIMEOUT
|
84
|
+
response = client.request(:execute_command_using_attachments) do |soap|
|
85
|
+
soap.endpoint = "#{@url}#{CLI_SERVICE}"
|
86
|
+
soap.header = {"ins1:sessionId" => @session_id}
|
87
|
+
body_details = { :nameSpace => namespace, :commandName => command, :commandArguments => args }
|
88
|
+
body_details.merge!({:payload => payload}) if payload
|
89
|
+
soap.body = body_details
|
90
|
+
end
|
91
|
+
result = response.body[:execute_command_using_attachments_response][:return]
|
92
|
+
return validate_cli_result(result)
|
93
|
+
rescue Savon::Error => error
|
94
|
+
raise "Error while executing CLI command over SOAP protocol: #{error.to_s}"
|
95
|
+
rescue => exception
|
96
|
+
raise "Error processing CLI(#{namespace}:#{command}) result: #{exception.to_s}"
|
97
|
+
end
|
98
|
+
|
99
|
+
def execute_cli_with_param_list(namespace, command, args = [])
|
100
|
+
BrpmAuto.log("blcli #{namespace} #{command} #{args.join(" ")}")
|
101
|
+
|
102
|
+
client = Savon.client("#{@url}#{CLI_WSDL}") do |wsdl, http|
|
103
|
+
http.auth.ssl.verify_mode = :none
|
104
|
+
end
|
105
|
+
client.http.read_timeout = HTTP_READ_TIMEOUT
|
106
|
+
response = client.request(:execute_command_by_param_list) do |soap|
|
107
|
+
soap.endpoint = "#{@url}#{CLI_SERVICE}"
|
108
|
+
soap.header = {"ins1:sessionId" => @session_id}
|
109
|
+
soap.body = { :nameSpace => namespace, :commandName => command, :commandArguments => args }
|
110
|
+
end
|
111
|
+
result = response.body[:execute_command_by_param_list_response][:return]
|
112
|
+
return validate_cli_result(result)
|
113
|
+
rescue Savon::Error => error
|
114
|
+
raise "Error while executing CLI command over SOAP protocol: #{error.to_s}"
|
115
|
+
rescue Exception => exception
|
116
|
+
raise "Error processing CLI(#{namespace}:#{command}) results: #{exception.to_s}"
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class BsaSoapClient < BsaSoapBase
|
2
|
+
def initialize(integration_settings = BrpmAuto.integration_settings)
|
3
|
+
@url = integration_settings.dns
|
4
|
+
@session_id = Login.new(integration_settings).login
|
5
|
+
end
|
6
|
+
|
7
|
+
def blpackage
|
8
|
+
@blpackage ||= BlPackage.new(@url, @session_id)
|
9
|
+
end
|
10
|
+
|
11
|
+
def job
|
12
|
+
@job ||= Job.new(@url, @session_id)
|
13
|
+
end
|
14
|
+
|
15
|
+
def job_run
|
16
|
+
@job_run ||= JobRun.new(@url, @session_id)
|
17
|
+
end
|
18
|
+
|
19
|
+
def deploy_job
|
20
|
+
@deploy_job ||= DeployJob.new(@url, @session_id)
|
21
|
+
end
|
22
|
+
|
23
|
+
def job_group
|
24
|
+
@job_group ||= JobGroup.new(@url, @session_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
def depot_group
|
28
|
+
@depot_group ||= DepotGroup.new(@url, @session_id)
|
29
|
+
end
|
30
|
+
|
31
|
+
def utility
|
32
|
+
@utility ||= Utility.new(@url, @session_id)
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
class ComplianceJob < BsaSoapBase
|
2
|
+
def add_component_to_job_by_job_db_key(options = {})
|
3
|
+
validate_cli_options_hash([:compliance_key, :component_key], options)
|
4
|
+
db_key_result = execute_cli_with_param_list(self.class, "addComponentToJobByJobDBKey",
|
5
|
+
[
|
6
|
+
options[:compliance_key], # Handle to compliance Job
|
7
|
+
options[:component_key] # Handle to component to be added
|
8
|
+
])
|
9
|
+
db_key = get_cli_return_value(db_key_result)
|
10
|
+
rescue => exception
|
11
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_named_server_to_job_by_job_db_key(options = {})
|
15
|
+
validate_cli_options_hash([:db_key, :server_name], options)
|
16
|
+
db_key_result = execute_cli_with_param_list(self.class, "addNamedServerToJobByJobDBKey",
|
17
|
+
[
|
18
|
+
options[:db_key], # Handle to the Compliance Job
|
19
|
+
options[:server_name] # Name of the server to be added
|
20
|
+
])
|
21
|
+
db_key = get_cli_return_value(db_key_result)
|
22
|
+
rescue => exception
|
23
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_component_based_compliance_job(options = {})
|
27
|
+
validate_cli_options_hash([:job_name, :group_id, :template_key, :server_name], options)
|
28
|
+
db_key_result = execute_cli_with_param_list(self.class, "createComponentBasedComplianceJob",
|
29
|
+
[
|
30
|
+
options[:job_name], # Name of the job to be created
|
31
|
+
options[:group_id], # Id of the parent job group for the compliance job
|
32
|
+
options[:template_key], # Handle to template describing the assets to be included in compliance
|
33
|
+
options[:server_name], # Target server for compliance job
|
34
|
+
options[:component_index] || 0 # Index of component on target server (typically 0)
|
35
|
+
])
|
36
|
+
db_key = get_cli_return_value(db_key_result)
|
37
|
+
rescue => exception
|
38
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_remediation_job_from_compliance_result_by_rule(options = {})
|
42
|
+
validate_cli_options_hash(
|
43
|
+
[:remediation_name, :job_group_name, :depot_group_name, :comp_job_key, :comp_job_run_id, :template_group_name, :template_name, :rule_grp_name, :rule_name, :target_component],
|
44
|
+
options)
|
45
|
+
db_key_result = execute_cli_with_param_list(self.class, "createRemediationJobFromComplianceResultByRule",
|
46
|
+
[
|
47
|
+
options[:remediation_name], # Name of the package
|
48
|
+
options[:job_group_name], # Name of a group that should contain the new remediation job(s)
|
49
|
+
options[:depot_group_name], # Name of a group that should contain the new package(s)
|
50
|
+
options[:comp_job_key], # Handle to compliance job whose job run result you want to package
|
51
|
+
options[:comp_job_run_id], # ID of the compliance job run whose result you want to package
|
52
|
+
options[:template_group_name], # Group name of the template used in the compliance job run
|
53
|
+
options[:template_name], # Name of the template used in the compliance job run
|
54
|
+
options[:rule_grp_name], # Name of the template rule group used in the compliance job run
|
55
|
+
options[:rule_name], # Name of the template rule used in the compliance job run
|
56
|
+
options[:target_component], # Name of the target component
|
57
|
+
options[:use_component_device_for_targets] || true, # Use the device of a component as the target of the remediation (defualt = true) devices are targets
|
58
|
+
options[:keep_unique_package_props] || true # Indicates if the package should uniquely save each local property for the compliance rule packages that are used
|
59
|
+
])
|
60
|
+
db_key = get_cli_return_value(db_key_result)
|
61
|
+
rescue => exception
|
62
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def create_remediation_job_from_compliance_result_by_server(options = {})
|
66
|
+
validate_cli_options_hash(
|
67
|
+
[:remediation_name, :job_group_name, :depot_group_name, :comp_job_key, :comp_job_run_id, :target_server, :template_group_name, :template_name, :target_component, :rule_grp_name, :rule_name],
|
68
|
+
options)
|
69
|
+
db_key_result = execute_cli_with_param_list(self.class, "createRemediationJobFromComplianceResultByServer",
|
70
|
+
[
|
71
|
+
options[:remediation_name], # Name of the package
|
72
|
+
options[:job_group_name], # Name of a group that should contain the new remediation job(s)
|
73
|
+
options[:depot_group_name], # Name of a group that should contain the new package(s)
|
74
|
+
options[:comp_job_key], # Handle to compliance job whose job run result you want to package
|
75
|
+
options[:comp_job_run_id], # ID of the compliance job run whose result you want to package
|
76
|
+
options[:target_server], # Name of the target server
|
77
|
+
options[:template_group_name], # Group name of the template used in the compliance job run
|
78
|
+
options[:template_name], # Name of the template used in the compliance job run
|
79
|
+
options[:target_component], # Name of the target component
|
80
|
+
options[:rule_grp_name], # Name of the template rule group used in the compliance job run
|
81
|
+
options[:rule_name], # Name of the template rule used in the compliance job run
|
82
|
+
options[:use_component_device_for_targets] || true, # Use the device of a component as the target of the remediation (defualt = true) devices are targets
|
83
|
+
options[:keep_unique_package_props] || true # Indicates if the package should uniquely save each local property for the compliance rule packages that are used
|
84
|
+
])
|
85
|
+
db_key = get_cli_return_value(db_key_result)
|
86
|
+
rescue => exception
|
87
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
88
|
+
end
|
89
|
+
|
90
|
+
def create_template_fltered_compliance_job(options = {})
|
91
|
+
validate_cli_options_hash([:job_name, :group_id, :template_key, :server_name], options)
|
92
|
+
db_key_result = execute_cli_with_param_list(self.class, "createTemplateFilteredComplianceJob",
|
93
|
+
[
|
94
|
+
options[:job_name], # Name of the job to be created
|
95
|
+
options[:group_id], # Id of the parent job group for the compliance job
|
96
|
+
options[:template_key], # Handle to the template describing the assets to be including in the compliance job
|
97
|
+
options[:server_name] # Target server for the compliance job
|
98
|
+
])
|
99
|
+
db_key = get_cli_return_value(db_key_result)
|
100
|
+
rescue => exception
|
101
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
102
|
+
end
|
103
|
+
|
104
|
+
def execute_job_and_wait(options = {})
|
105
|
+
validate_cli_options_hash([:job_key], options)
|
106
|
+
job_key_result = execute_cli_with_param_list(self.class, "executeJobAndWait",
|
107
|
+
[
|
108
|
+
options[:job_key] # Handle to the compliance job to be executed
|
109
|
+
])
|
110
|
+
job_key = get_cli_return_value(job_key_result)
|
111
|
+
rescue => exception
|
112
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
113
|
+
end
|
114
|
+
|
115
|
+
def get_dbkey_by_group_and_name(options = {})
|
116
|
+
validate_cli_options_hash([:group_name, :job_name], options)
|
117
|
+
db_key_result = execute_cli_with_param_list(self.class, "getDBKeyByGroupAndName",
|
118
|
+
[
|
119
|
+
options[:group_name], # Fully qualified path to the job group containing the job
|
120
|
+
options[:job_name] # Name of the job
|
121
|
+
])
|
122
|
+
db_key = get_cli_return_value(db_key_result)
|
123
|
+
rescue => exception
|
124
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
125
|
+
end
|
126
|
+
|
127
|
+
def set_auto_remediation(options = {})
|
128
|
+
validate_cli_options_hash([:job_key, :job_name, :depot_group, :job_group], options)
|
129
|
+
db_key_result = execute_cli_with_param_list(self.class, "setAutoRemediation",
|
130
|
+
[
|
131
|
+
options[:job_key], # Handle to compliance job
|
132
|
+
options[:job_name], # Name for auto-remediation job
|
133
|
+
options[:depot_group], # Name of the depot group to store files in
|
134
|
+
options[:job_group], # Name of the job group to store the remediation job in
|
135
|
+
options[:is_auto_remediate] || true, # Auto-remediation state for the job - true = set
|
136
|
+
options[:use_component_device_for_targets] || true, # Use the device of a component as the target of the remediation (defualt = true) devices are targets
|
137
|
+
options[:keep_unique_package_props] || true # Indicates if the package should uniquely save each local property for the compliance rule packages that are used
|
138
|
+
])
|
139
|
+
db_key = get_cli_return_value(db_key_result)
|
140
|
+
rescue => exception
|
141
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
142
|
+
end
|
143
|
+
|
144
|
+
def set_description(options = {})
|
145
|
+
validate_cli_options_hash([:job_key, :desc], options)
|
146
|
+
db_key_result = execute_cli_with_param_list(self.class, "setDescription",
|
147
|
+
[
|
148
|
+
options[:job_key], # handle to compliance job
|
149
|
+
options[:desc] # description of job
|
150
|
+
])
|
151
|
+
db_key = get_cli_return_value(db_key_result)
|
152
|
+
rescue => exception
|
153
|
+
raise "Exception executing #{self.class} function: #{exception.to_s}"
|
154
|
+
end
|
155
|
+
end
|