brpm_content_framework 0.2.39 → 0.2.40

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NGJmYTgzYjZlNDBjMzYxODY3NDIwZWIxNDNlZmNhZDkzZDNlYmJiYQ==
4
+ MmNhY2ZkODI3N2M1MDk4OTk3YTFlN2EzNzFlMGE3OGU1NjRmMDNiNw==
5
5
  data.tar.gz: !binary |-
6
- ZjkzY2VjNzZlMGU1NmM1MGU3YTgyMGY4NTU0YjI4NTA5YmZlNWUzZg==
6
+ MTJlZGFhODljMTQyYjdiNzQxMjNlZjk0YzU4ODQ2MTM3NTcwMDRkOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjE3N2MyMTJjY2E0MWYwYmJmZWJjZDBlNTJlZjE2ZTU4ZDBiNjYyYTgzYTRj
10
- MzYxN2JiN2NiYzA1Y2ZiZGUyYjYzN2U0ODgzMGE1NGZjNjc0YjljNjAyZjc0
11
- MzM0NTljNjhlNjEzNGFhYjRiYmI0NDU5ODU1ZTU5OWM1OGQxMjM=
9
+ ODdhYjYwNDA2NzM5N2FkODUzMTQzODE5ZmFkMzA1YWMxZDdmNzllMTU3YTA4
10
+ ZjU2ZjVlNmJjNDg5YzU4YjM2YTc0NDkyODIyOTBiMWRmN2ZlNTQ4N2JjMDc2
11
+ OGEyMjliNTZiYTRkNjczNDY0NDY2ZmZiMDY3N2RhNGJkMDcwODk=
12
12
  data.tar.gz: !binary |-
13
- ODJiOTk1YmRiM2IwNGM2MzM2Nzk0NDNmYjlmY2JlNTY1OGQ0OTJkMDNjNmRi
14
- ZmY5NjAyMDA0YTM5YjQ5YWE0N2UxMjYwODk1ZGE4ZWJkNzFhMGY2N2JlYTFh
15
- MGQzOWQ4YzczZjQ3Yzk4YTIxZDkyMmQzZjk3Njc1ODYwYTVhYmQ=
13
+ MzU2OTZjMjMxMDNjMjI3NmRmYWY4MzU3ZTlhYzg2MDU3MTg0OTFjMWM5NDRl
14
+ MjNkMTdlN2FhYWI5YWQ3NWQzNjkzYzhkMmFlYTEwYTM1MTliMjIzNDkzMTQz
15
+ ZWViZTM4MzA0ZmY3OGI4YzBhMmJmY2RlYWZlMTI1ZWFjMDAyZTM=
data/bin/brpm_uninstall CHANGED
@@ -7,6 +7,7 @@ end
7
7
 
8
8
  require "yaml"
9
9
  require "brpm_auto"
10
+ require "module_installer"
10
11
 
11
12
  params = {}
12
13
  params["log_file"] = "/tmp/brpm_install.log"
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.39
1
+ version: 0.2.40
2
2
  author: Niek Bartholomeus
3
3
  email: niek.bartholomeus@gmail.com
4
4
  homepage: https://github.com/BMC-RLM/brpm_content_framework
@@ -73,8 +73,13 @@ class BrpmScriptExecutor
73
73
  command += " \"#{max_records}\"" if max_records
74
74
  end
75
75
 
76
+ _, stderr, _, status = BrpmAuto.execute_command(command) do |stdout_err|
77
+ BrpmAuto.log " stdout:#{stdout_err.chomp}"
78
+ end
79
+
76
80
  else
77
- env_var_gem_home = "export GEM_HOME=#{ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"};"
81
+ env_vars = {}
82
+ env_vars["GEM_HOME"] = ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"
78
83
 
79
84
  module_path = get_module_gem_path(modul, module_version)
80
85
 
@@ -87,26 +92,18 @@ class BrpmScriptExecutor
87
92
  gemfile_path = "#{module_path}/Gemfile"
88
93
  if File.exists?(gemfile_path)
89
94
  BrpmAuto.log "Using Gemfile #{gemfile_path}."
90
- env_var_bundler = "export BUNDLE_GEMFILE=#{gemfile_path};"
95
+ env_vars["BUNDLE_GEMFILE"] = gemfile_path
91
96
  require_bundler = "require 'bundler/setup';"
92
97
  else
93
98
  BrpmAuto.log("This module doesn't have a Gemfile.")
94
- env_var_bundler = ""
95
99
  require_bundler = ""
96
100
  end
97
101
 
98
102
  BrpmAuto.log "Executing the script in a separate process..."
99
- ruby_command = <<EOR
100
- #{require_bundler}
101
- require \\"brpm_script_executor\\"
102
- BrpmScriptExecutor.execute_automation_script_from_other_process(\\"#{modul}\\", \\"#{name}\\", \\"#{params_path}\\", \\"#{automation_type}\\", \\"#{parent_id}\\", \\"#{offset}\\", \\"#{max_records}\\")
103
- EOR
104
- command = "#{env_var_gem_home}#{env_var_bundler}ruby -e \"#{ruby_command}\""
105
- end
106
-
107
- _, stderr, _, status = Bundler.with_clean_env do
108
- BrpmAuto.execute_command(command) do |stdout_err|
109
- BrpmAuto.log " #{stdout_err.chomp}"
103
+ _, stderr, _, status = Bundler.with_clean_env do
104
+ BrpmAuto.execute_command(env_vars, "ruby", "-e", "#{require_bundler};require \"brpm_script_executor\";BrpmScriptExecutor.execute_automation_script_from_other_process(\"#{modul}\", \"#{name}\", \"#{params_path}\", \"#{automation_type}\", \"#{parent_id}\", \"#{offset}\", \"#{max_records}\")") do |stdout_err|
105
+ BrpmAuto.log " stdout:#{stdout_err.chomp}"
106
+ end
110
107
  end
111
108
  end
112
109
 
@@ -114,6 +111,8 @@ EOR
114
111
 
115
112
  raise "The process failed with status #{status.exitstatus}.\n#{stderr}" unless status.success?
116
113
 
114
+ BrpmAuto.log "The process finished succesfully."
115
+
117
116
  if automation_type == "resource_automation"
118
117
  result_path = params_path.sub!("params", "result")
119
118
  BrpmAuto.log "Loading the result from #{result_path} and cleaning it up..."
@@ -179,7 +179,7 @@ class ModuleInstaller
179
179
  end
180
180
  raise "The process failed with status #{status.exitstatus}.\n#{stderr}" unless status.success?
181
181
 
182
- unless stdout =~ /Image is up to date for/ or output =~ /Downloaded newer image for/
182
+ unless stdout =~ /Image is up to date for/ or stdout =~ /Downloaded newer image for/
183
183
  if BrpmAuto.global_params["execute_automation_scripts_in_docker"] == "always"
184
184
  raise "Docker image bmcrlm/#{spec.name}:#{spec.version} doesn't exist."
185
185
  elsif BrpmAuto.global_params["execute_automation_scripts_in_docker"] == "if_docker_image_exists"
@@ -193,7 +193,7 @@ class ModuleInstaller
193
193
  case BrpmAuto.global_params["execute_automation_scripts_in_docker"]
194
194
  when "always", "if_docker_image_exists"
195
195
  BrpmAuto.log "Removing the docker image..."
196
- _, stderr, _, status = BrpmAuto.execute_command("docker rmi $(docker images | grep bmcrlm/#{module_name}:#{module_version} | awk {'print $3'})") do |stdout_err|
196
+ _, stderr, _, status = BrpmAuto.execute_command("docker images | grep bmcrlm/#{module_name} | grep #{module_version} | awk {'print $3'} | xargs docker rmi") do |stdout_err|
197
197
  BrpmAuto.log " #{stdout_err.chomp}"
198
198
  end
199
199
  raise "The process failed with status #{status.exitstatus}.\n#{stderr}" unless status.success?
data/lib/utilities.rb CHANGED
@@ -78,15 +78,15 @@ module Utilities
78
78
  cmd_result
79
79
  end
80
80
 
81
- def execute_command(command, sensitive_data = nil)
82
- Open3.popen3(command) do |stdin, stdout, stderr, thread|
81
+ def execute_command(*commands)
82
+ Open3.popen3(*commands) do |stdin, stdout, stderr, thread|
83
83
  logs = {:out => "", :err => ""}
84
84
 
85
85
  if block_given?
86
86
  { :out => stdout, :err => stderr }.each do |key, stream|
87
87
  Thread.new do
88
88
  while line = stream.gets
89
- privatized_line = BrpmAuto.privatize(line, sensitive_data)
89
+ privatized_line = BrpmAuto.privatize(line)
90
90
  logs[key] += privatized_line
91
91
  yield privatized_line
92
92
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.39
4
+ version: 0.2.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus