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 +8 -8
- data/bin/brpm_uninstall +1 -0
- data/config.yml +1 -1
- data/lib/brpm_script_executor.rb +13 -14
- data/lib/module_installer.rb +2 -2
- data/lib/utilities.rb +3 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmNhY2ZkODI3N2M1MDk4OTk3YTFlN2EzNzFlMGE3OGU1NjRmMDNiNw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MTJlZGFhODljMTQyYjdiNzQxMjNlZjk0YzU4ODQ2MTM3NTcwMDRkOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODdhYjYwNDA2NzM5N2FkODUzMTQzODE5ZmFkMzA1YWMxZDdmNzllMTU3YTA4
|
10
|
+
ZjU2ZjVlNmJjNDg5YzU4YjM2YTc0NDkyODIyOTBiMWRmN2ZlNTQ4N2JjMDc2
|
11
|
+
OGEyMjliNTZiYTRkNjczNDY0NDY2ZmZiMDY3N2RhNGJkMDcwODk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzU2OTZjMjMxMDNjMjI3NmRmYWY4MzU3ZTlhYzg2MDU3MTg0OTFjMWM5NDRl
|
14
|
+
MjNkMTdlN2FhYWI5YWQ3NWQzNjkzYzhkMmFlYTEwYTM1MTliMjIzNDkzMTQz
|
15
|
+
ZWViZTM4MzA0ZmY3OGI4YzBhMmJmY2RlYWZlMTI1ZWFjMDAyZTM=
|
data/bin/brpm_uninstall
CHANGED
data/config.yml
CHANGED
data/lib/brpm_script_executor.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
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
|
-
|
100
|
-
#{require_bundler}
|
101
|
-
|
102
|
-
|
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..."
|
data/lib/module_installer.rb
CHANGED
@@ -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
|
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
|
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(
|
82
|
-
Open3.popen3(
|
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
|
89
|
+
privatized_line = BrpmAuto.privatize(line)
|
90
90
|
logs[key] += privatized_line
|
91
91
|
yield privatized_line
|
92
92
|
end
|