brpm_module_bladelogic 0.1.5
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.
- checksums.yaml +15 -0
- data/.gitignore +37 -0
- data/.ruby-version +1 -0
- data/.travis.yml +17 -0
- data/Gemfile +3 -0
- data/LICENSE +21 -0
- data/README.md +7 -0
- data/Rakefile +24 -0
- data/automations/create_package.rb +29 -0
- data/automations/create_package.txt +26 -0
- data/automations/deploy_package.rb +137 -0
- data/automations/deploy_package.txt +53 -0
- data/bin/create_bl_package +22 -0
- data/brpm_module_bladelogic.gemspec +39 -0
- data/config.yml +13 -0
- data/lib/bl_rest/bsa_rest_client.rb +65 -0
- data/lib/bl_soap/blpackage.rb +43 -0
- data/lib/bl_soap/bsa_soap_base.rb +118 -0
- data/lib/bl_soap/bsa_soap_client.rb +34 -0
- data/lib/bl_soap/compliance_job.rb +155 -0
- data/lib/bl_soap/deploy_job.rb +48 -0
- data/lib/bl_soap/depot_group.rb +47 -0
- data/lib/bl_soap/job.rb +376 -0
- data/lib/bl_soap/job_group.rb +72 -0
- data/lib/bl_soap/job_management.rb +22 -0
- data/lib/bl_soap/job_result.rb +12 -0
- data/lib/bl_soap/job_run.rb +271 -0
- data/lib/bl_soap/login.rb +47 -0
- data/lib/bl_soap/nsh_script_job.rb +14 -0
- data/lib/bl_soap/patch_catalog.rb +178 -0
- data/lib/bl_soap/patch_remediation_job.rb +137 -0
- data/lib/bl_soap/patching_job.rb +250 -0
- data/lib/bl_soap/server.rb +12 -0
- data/lib/bl_soap/template.rb +13 -0
- data/lib/bl_soap/utility.rb +99 -0
- data/resource_automations/select_job.rb +33 -0
- data/resource_automations/select_job.txt +15 -0
- data/tests/create_package_spec.rb +28 -0
- data/tests/deploy_package_spec.rb +23 -0
- data/tests/spec_helper.rb +90 -0
- metadata +128 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
def execute_script(params, parent_id, offset, max_records)
|
2
|
+
root_group_name = "/#{params["application"].downcase}/public"
|
3
|
+
|
4
|
+
BrpmAuto.log("Logging on to Bladelogic instance #{BsaSoapClient.get_url} with user #{BsaSoapClient.get_username} and role #{BsaSoapClient.get_role}...")
|
5
|
+
session_id = BsaSoapClient.login
|
6
|
+
|
7
|
+
if parent_id.blank?
|
8
|
+
BrpmAuto.log("Retrieving all the groups from group #{root_group_name}...")
|
9
|
+
groups = JobGroup.find_all_groups_by_parent_group_name(session_id, {:job_group => root_group_name})
|
10
|
+
|
11
|
+
groups = groups.to_s.split(' ').sort()
|
12
|
+
|
13
|
+
results = []
|
14
|
+
groups.each do |group|
|
15
|
+
results << { :title => group, :key => group, :isFolder => true, :hasChild => true, :hideCheckbox => true }
|
16
|
+
end
|
17
|
+
else
|
18
|
+
job_type = parent_id
|
19
|
+
group_name = "#{root_group_name}/#{job_type}"
|
20
|
+
|
21
|
+
BrpmAuto.log("Retrieving all the objects from group #{group_name}...")
|
22
|
+
jobs = Job.list_all_by_group(session_id, {:group_name => group_name})
|
23
|
+
|
24
|
+
jobs = jobs.to_s.split(' ').sort
|
25
|
+
|
26
|
+
results = []
|
27
|
+
jobs.each do |job|
|
28
|
+
results << { :title => job, :key => "#{job_type}|#{job}", :isFolder => false }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
results
|
33
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
#=== BMC Application Automation Integration Server: BladeLogic on C4 ===#
|
3
|
+
# [integration_id=6]
|
4
|
+
#=== End ===#
|
5
|
+
|
6
|
+
require "#{ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"}/gems/brpm_content-#{ENV["BRPM_CONTENT_VERSION"] || "latest"}/modules/framework/brpm_script_executor.rb"
|
7
|
+
|
8
|
+
def execute(script_params, parent_id, offset, max_records)
|
9
|
+
script_params["SS_integration_dns"] = SS_integration_dns
|
10
|
+
script_params["SS_integration_username"] = SS_integration_username
|
11
|
+
script_params["SS_integration_password_enc"] = SS_integration_password_enc
|
12
|
+
script_params["SS_integration_details"] = YAML.load(SS_integration_details)
|
13
|
+
|
14
|
+
BrpmScriptExecutor.execute_resource_automation_script_from_gem("brpm_module_bladelogic", "select_job", script_params, parent_id, offset, max_records)
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe 'create package' do
|
4
|
+
before(:all) do
|
5
|
+
setup_brpm_auto
|
6
|
+
end
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
cleanup_package "/Applications/E-Finance/EF - Java calculation engine", "1.0.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
describe '' do
|
13
|
+
it 'should create a package in BladeLogic' do # need to add logic to delete the bl package in Bladelogic
|
14
|
+
params = get_default_params
|
15
|
+
params = params.merge(get_integration_params_for_bladelogic)
|
16
|
+
|
17
|
+
params["application"] = 'E-Finance'
|
18
|
+
params["component"] = 'EF - Java calculation engine'
|
19
|
+
params["component_version"] = '1.0.0'
|
20
|
+
|
21
|
+
BrpmScriptExecutor.execute_automation_script_from_gem("brpm_module_bladelogic", "create_package", params)
|
22
|
+
|
23
|
+
version_tag = @brpm_rest_client.get_version_tag("E-Finance","EF - Java calculation engine", "development", "1.0.0")
|
24
|
+
expect(version_tag).not_to be_nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative "spec_helper"
|
2
|
+
|
3
|
+
describe 'deploy package' do
|
4
|
+
before(:all) do
|
5
|
+
setup_brpm_auto
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '' do
|
9
|
+
it 'should deploy a package in BladeLogic' do
|
10
|
+
params = get_default_params
|
11
|
+
params = params.merge(get_integration_params_for_bladelogic)
|
12
|
+
|
13
|
+
params["application"] = 'E-Finance'
|
14
|
+
params["component"] = 'EF - Java calculation engine'
|
15
|
+
params["component_version"] = '2.0.0'
|
16
|
+
params["request_environment"] = "development"
|
17
|
+
params["server_group"] = "EF - java app servers - development"
|
18
|
+
|
19
|
+
BrpmScriptExecutor.execute_automation_script_from_gem("brpm_module_bladelogic", "deploy_package", params)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require "brpm_script_executor"
|
3
|
+
|
4
|
+
def setup_brpm_auto
|
5
|
+
FileUtils.mkdir_p "/tmp/brpm_content"
|
6
|
+
create_symlink_to_gemset
|
7
|
+
|
8
|
+
BrpmAuto.setup( get_default_params.merge!(get_integration_params_for_bladelogic) )
|
9
|
+
|
10
|
+
BrpmAuto.require_module "brpm"
|
11
|
+
BrpmAuto.require_module "bladelogic"
|
12
|
+
|
13
|
+
@brpm_rest_client = BrpmRestClient.new('http://brpm-content.pulsar-it.be:8088/brpm', ENV["BRPM_API_TOKEN"])
|
14
|
+
@bsa_soap_client = BsaSoapClient.new
|
15
|
+
end
|
16
|
+
|
17
|
+
def get_default_params
|
18
|
+
params = {}
|
19
|
+
params['also_log_to_console'] = 'true'
|
20
|
+
|
21
|
+
params['brpm_url'] = 'http://brpm-content.pulsar-it.be:8088/brpm'
|
22
|
+
params['brpm_api_token'] = ENV["BRPM_API_TOKEN"]
|
23
|
+
|
24
|
+
params['output_dir'] = "/tmp/brpm_content"
|
25
|
+
|
26
|
+
params
|
27
|
+
end
|
28
|
+
|
29
|
+
def get_integration_params_for_bladelogic
|
30
|
+
params = {}
|
31
|
+
params["SS_integration_dns"] = "https://bladelogic.pulsar-it.be:9843"
|
32
|
+
params["SS_integration_username"] = "BLAdmin"
|
33
|
+
params["SS_integration_password"] = ENV["BLADELOGIC_PASSWORD"]
|
34
|
+
params["SS_integration_details"] = {}
|
35
|
+
params["SS_integration_details"]["role"] = "BLAdmins"
|
36
|
+
|
37
|
+
params
|
38
|
+
end
|
39
|
+
|
40
|
+
def cleanup_requests_and_plans_for_app(app_name)
|
41
|
+
app = @brpm_rest_client.get_app_by_name(app_name)
|
42
|
+
|
43
|
+
requests = @brpm_rest_client.get_requests_by({ "app_id" => app["id"]})
|
44
|
+
|
45
|
+
requests.each do |request|
|
46
|
+
@brpm_rest_client.delete_request(request["id"]) unless request.has_key?("request_template")
|
47
|
+
end
|
48
|
+
|
49
|
+
plan_template = @brpm_rest_client.get_plan_template_by_name("#{app_name} Release Plan")
|
50
|
+
|
51
|
+
plans = @brpm_rest_client.get_plans_by({ "plan_template_id" => plan_template["id"]})
|
52
|
+
plans.each do |plan|
|
53
|
+
@brpm_rest_client.cancel_plan(plan["id"])
|
54
|
+
@brpm_rest_client.delete_plan(plan["id"])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def cleanup_version_tags_for_app(app_name)
|
59
|
+
app = @brpm_rest_client.get_app_by_name(app_name)
|
60
|
+
|
61
|
+
version_tags = @brpm_rest_client.get_version_tags_by({ "app_id" => app["id"]})
|
62
|
+
|
63
|
+
version_tags.each do |version_tag|
|
64
|
+
@brpm_rest_client.delete_version_tag(version_tag["id"])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def cleanup_package path, name
|
69
|
+
BrpmAuto.log("Deleting blpackage #{path}/#{name}...")
|
70
|
+
begin
|
71
|
+
@bsa_soap_client.blpackage.delete_blpackage_by_group_and_name({ :parent_group => path, :package_name => name })
|
72
|
+
rescue Exception => ex
|
73
|
+
if ex.message =~ /Cannot find depot object by name/
|
74
|
+
BrpmAuto.log "assuming that the package didn't exist so all is fine."
|
75
|
+
else
|
76
|
+
raise ex
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def pack_response key, value
|
82
|
+
BrpmAuto.log "pack_response: #{key}: #{value}"
|
83
|
+
end
|
84
|
+
|
85
|
+
def create_symlink_to_gemset
|
86
|
+
module_name = File.basename(File.expand_path("#{File.dirname(__FILE__)}/.."))
|
87
|
+
symlink = "#{ENV["GEM_HOME"]}/gems/#{module_name}-999.0.0"
|
88
|
+
FileUtils.rm(symlink) if File.exists?(symlink)
|
89
|
+
FileUtils.ln_s(File.expand_path("#{File.dirname(__FILE__)}/.."), symlink)
|
90
|
+
end
|
metadata
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: brpm_module_bladelogic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Niek Bartholomeus
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-07-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: brpm_content
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.11
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.11
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: BladeLogic automation scripts and libraries to run on top of the BRPM
|
56
|
+
Content framework. See https://github.com/BMC-RLM/brpm_content for more information
|
57
|
+
about the BRPM Content framework
|
58
|
+
email: niek.bartholomeus@gmail.com
|
59
|
+
executables:
|
60
|
+
- create_bl_package
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- .gitignore
|
65
|
+
- .ruby-version
|
66
|
+
- .travis.yml
|
67
|
+
- Gemfile
|
68
|
+
- LICENSE
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- automations/create_package.rb
|
72
|
+
- automations/create_package.txt
|
73
|
+
- automations/deploy_package.rb
|
74
|
+
- automations/deploy_package.txt
|
75
|
+
- bin/create_bl_package
|
76
|
+
- brpm_module_bladelogic.gemspec
|
77
|
+
- config.yml
|
78
|
+
- lib/bl_rest/bsa_rest_client.rb
|
79
|
+
- lib/bl_soap/blpackage.rb
|
80
|
+
- lib/bl_soap/bsa_soap_base.rb
|
81
|
+
- lib/bl_soap/bsa_soap_client.rb
|
82
|
+
- lib/bl_soap/compliance_job.rb
|
83
|
+
- lib/bl_soap/deploy_job.rb
|
84
|
+
- lib/bl_soap/depot_group.rb
|
85
|
+
- lib/bl_soap/job.rb
|
86
|
+
- lib/bl_soap/job_group.rb
|
87
|
+
- lib/bl_soap/job_management.rb
|
88
|
+
- lib/bl_soap/job_result.rb
|
89
|
+
- lib/bl_soap/job_run.rb
|
90
|
+
- lib/bl_soap/login.rb
|
91
|
+
- lib/bl_soap/nsh_script_job.rb
|
92
|
+
- lib/bl_soap/patch_catalog.rb
|
93
|
+
- lib/bl_soap/patch_remediation_job.rb
|
94
|
+
- lib/bl_soap/patching_job.rb
|
95
|
+
- lib/bl_soap/server.rb
|
96
|
+
- lib/bl_soap/template.rb
|
97
|
+
- lib/bl_soap/utility.rb
|
98
|
+
- resource_automations/select_job.rb
|
99
|
+
- resource_automations/select_job.txt
|
100
|
+
- tests/create_package_spec.rb
|
101
|
+
- tests/deploy_package_spec.rb
|
102
|
+
- tests/spec_helper.rb
|
103
|
+
homepage: https://github.com/BMC-RLM/brpm_module_bladelogic
|
104
|
+
licenses:
|
105
|
+
- GNU General Public License v2.0
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ! '>='
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.1.9
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: BladeLogic automation scripts and libraries to run on top of the BRPM Content
|
127
|
+
framework
|
128
|
+
test_files: []
|