brpm_module_brpd 0.1.0

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 ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ ZDM5M2ZlNGJlOWQxYzYxMjdkYzdmNjUwNDExYzI1MmI2MWVlY2JjYg==
5
+ data.tar.gz: !binary |-
6
+ ZDIzMmI1MjU3MDRjMWUzZDJkYzZmZTg4NjliNWU0ZDE5NWYwN2ZhYQ==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ YzcyYzcwOGNjODEyOTBlZjAyNmE1NWNmZjVlMDVmMmQxZjljNDg2NzdiNDQ4
10
+ MTliZWYyOWIzMDQzMjJmMjY1ZWJmMmIyOGMxZjcxOTFhMmFlY2E2ZGJjMGY2
11
+ MWZjNmE2Y2FiMDNkMjdkYzI1NDQwODBjNjRjM2NkYWNmY2MwOWY=
12
+ data.tar.gz: !binary |-
13
+ YWZhMzE0OTFkZDNkNzU2NTgxNWFlMmJlYTVhNDdkNWZhN2FmNDZjZjYxNmYy
14
+ NGNjZDYyZGRkZGE4NDhlYTA5ZDIzYzlkNTBhOWE4MTgyZmMxZDU5NWNmYjJl
15
+ ODQ4ZGRkM2I4YzdmODVmNWJkYzc0YzBlZjYwODk0MGU1NmNjYmU=
data/.gitignore ADDED
@@ -0,0 +1,37 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ Gemfile.lock
30
+ .ruby-gemset
31
+
32
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
33
+ .rvmrc
34
+
35
+ .DS_Store
36
+
37
+ .idea
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 BMC-RLM
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # BRPD module for BRPM
2
+
3
+ [![Build Status](https://travis-ci.org/BMC-RLM/brpm_module_brpd.svg?branch=master)](https://travis-ci.org/BMC-RLM/brpm_module_brpd)
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/brpm_module_brpd.png)](http://badge.fury.io/rb/brpm_module_brpd)
6
+
7
+ This repository represents a BRPD module, to be used on top of the [BRPM content framework](https://github.com/BMC-RLM/brpm_content_framework). It contains automation scripts to create and deploy BRPD packages.
data/Rakefile ADDED
@@ -0,0 +1,24 @@
1
+ # Copied from https://github.com/mitchellh/vagrant-aws/blob/master/Rakefile
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ require 'rspec/core/rake_task'
5
+
6
+ # Immediately sync all stdout so that tools like buildbot can
7
+ # immediately load in the output.
8
+ $stdout.sync = true
9
+ $stderr.sync = true
10
+
11
+ # Change to the directory of this file.
12
+ Dir.chdir(File.expand_path("../", __FILE__))
13
+
14
+ # This installs the tasks that help with gem creation and
15
+ # publishing.
16
+ Bundler::GemHelper.install_tasks
17
+
18
+ # Install the `spec` task so that we can run tests.
19
+ RSpec::Core::RakeTask.new do |task|
20
+ task.pattern = "tests/**/*_spec.rb"
21
+ end
22
+
23
+ # Default task is to run the unit tests
24
+ task :default => "spec"
@@ -0,0 +1,2 @@
1
+ description: creates a BRPD package instance for a component and component version
2
+ integration_server_type: BRPD
@@ -0,0 +1,16 @@
1
+ params = BrpmAuto.params
2
+
3
+ brpd_http_client = BrpdHttpClient.new
4
+
5
+ BrpmAuto.log("Creating package #{params["component"]}:#{params["component_version"]}...")
6
+ brpd_http_client.create_package_instance(params["component"], params["component_version"])
7
+
8
+ brpm_rest_client = BrpmRestClient.new
9
+
10
+ BrpmAuto.log "Getting all environments of application #{params["application"]} ..."
11
+ environments = brpm_rest_client.get_environments_of_application(params["application"])
12
+
13
+ environments.each do |environment|
14
+ BrpmAuto.log "Creating the version tag for version #{params["component_version"]} of application #{params["application"]} and component #{params["component"]} in environment #{environment["name"]} ..."
15
+ environment = brpm_rest_client.create_version_tag(params["application"], params["component"], environment["name"], params["component_version"])
16
+ end
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ require "brpm_script_executor"
3
+
4
+ params = {}
5
+ params["application"] = ENV["APPLICATION"]
6
+ params["component"] = ENV["COMPONENT"]
7
+ params["component_version"] = ENV["COMPONENT_VERSION"]
8
+
9
+ params["brpm_url"] = "http://#{ENV["BRPM_HOST"]}:#{ENV["BRPM_PORT"]}/brpm"
10
+ params["brpm_api_token"] = ENV["BRPM_TOKEN"]
11
+
12
+ params["SS_integration_dns"] = ENV["SS_INTEGRATION_DNS"]
13
+ params["SS_integration_username"] = ENV["SS_INTEGRATION_USERNAME"]
14
+ params["SS_integration_password"] = ENV["SS_INTEGRATION_PASSWORD"]
15
+
16
+ params["log_file"] = ENV["LOG_FILE"]
17
+ params["also_log_to_console"] = "true"
18
+
19
+ BrpmScriptExecutor.execute_automation_script("brpm_module_brpd", "create_package", params)
20
+
data/config.yml ADDED
@@ -0,0 +1,11 @@
1
+ dependencies:
2
+ - brpm_module_brpm
3
+
4
+ version: 0.1.0
5
+
6
+ author: Niek Bartholomeus
7
+ email: niek.bartholomeus@gmail.com
8
+ homepage: https://github.com/BMC-RLM/brpm_module_brpd
9
+ license: MIT
10
+ summary: BRPD automation scripts and libraries to run on top of the BRPM Content framework
11
+ description: BRPD automation scripts and libraries to run on top of the BRPM Content framework. See https://github.com/BMC-RLM/brpm_content_framework for more information about the BRPM Content framework
@@ -0,0 +1,50 @@
1
+ require 'json'
2
+ require 'rest-client'
3
+ require 'uri'
4
+ require 'base64'
5
+ require 'xmlsimple'
6
+ require 'builder'
7
+
8
+ class BrpdHttpClient
9
+ def initialize(integration_settings = BrpmAuto.integration_settings)
10
+ @url = integration_settings.dns
11
+ @username = integration_settings.username
12
+ @password = integration_settings.password
13
+ end
14
+
15
+ def create_package_instance(package, instance_name = nil, properties = nil, locked_status='No')
16
+ raise 'No valid package name/ID provided.' if package.nil?
17
+ command = locked_status == 'No' ? 'instance create package' : 'instance create locked package'
18
+ xml_to_hash_response = send_xml_request(command, [package, instance_name, properties])
19
+
20
+ xml_to_hash_response['result'][0]['response']
21
+ end
22
+
23
+ def send_xml_request(command, arguments = [])
24
+ url = "#{@url}/index.php/api/processRequest.xml"
25
+ request_doc_xml = Builder::XmlMarkup.new
26
+ request_doc_xml.q(auth: "#{@username} #{@password}") do
27
+ request_doc_xml.request(command: command) do
28
+ arguments.each { |arg|
29
+ request_doc_xml.arg("#{arg}") if arg.present?
30
+ }
31
+ end
32
+ end
33
+
34
+ xml_response = RestClient.post(url, request_doc_xml, content_type: :xml, accept: :xml)
35
+ xml_to_hash_response = XmlSimple.xml_in(xml_response)
36
+
37
+ result = xml_to_hash_response['result'][0]
38
+
39
+ if result['rc'] != '0' || result['message'] != 'Ok'
40
+ msg = "Error while posting to URL #{url}: #{result['message']}"
41
+ response_value = parse_response_value(result)
42
+ msg += "\nResponse value: #{response_value}" if response_value.present?
43
+ raise msg
44
+ end
45
+
46
+ xml_to_hash_response
47
+ end
48
+ end
49
+
50
+
data/module.gemspec ADDED
@@ -0,0 +1,36 @@
1
+ require "yaml"
2
+
3
+ config = YAML.load_file(File.join(File.dirname(__FILE__), "config.yml"))
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = File.basename(File.expand_path(File.dirname(__FILE__))).sub("-#{config["version"]}", "")
7
+ spec.version = config["version"]
8
+ spec.platform = Gem::Platform::RUBY
9
+ spec.license = config["license"]
10
+ spec.authors = [config["author"]]
11
+ spec.email = config["email"]
12
+ spec.homepage = config["homepage"]
13
+ spec.summary = config["summary"]
14
+ spec.description = config["description"]
15
+
16
+ spec.add_runtime_dependency "brpm_content_framework", ">=0.2.8"
17
+
18
+ if config["dependencies"]
19
+ config["dependencies"].each do |dependency|
20
+ if dependency.is_a?(Hash)
21
+ modul = dependency.keys[0]
22
+ options = dependency.values[0]
23
+ else
24
+ modul = dependency
25
+ options = {}
26
+ end
27
+ spec.add_runtime_dependency modul, options["version"]
28
+ end
29
+ end
30
+
31
+ spec.add_development_dependency "rake"
32
+ spec.add_development_dependency "rspec"
33
+
34
+ spec.files = `git ls-files`.split("\n")
35
+ spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
36
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: brpm_module_brpd
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Niek Bartholomeus
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-09-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: brpm_content_framework
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ! '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.2.8
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ! '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.2.8
27
+ - !ruby/object:Gem::Dependency
28
+ name: brpm_module_brpm
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
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: rake
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
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: BRPD automation scripts and libraries to run on top of the BRPM Content
70
+ framework. See https://github.com/BMC-RLM/brpm_content_framework for more information
71
+ about the BRPM Content framework
72
+ email: niek.bartholomeus@gmail.com
73
+ executables:
74
+ - create_package_instance
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - .gitignore
79
+ - Gemfile
80
+ - LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - automations/create_package_instance.meta
84
+ - automations/create_package_instance.rb
85
+ - bin/create_package_instance
86
+ - config.yml
87
+ - lib/brpd_http_client.rb
88
+ - module.gemspec
89
+ homepage: https://github.com/BMC-RLM/brpm_module_brpd
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.1.9
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: BRPD automation scripts and libraries to run on top of the BRPM Content framework
113
+ test_files: []