brpm_content_framework 0.2.33 → 0.2.34
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 +8 -8
- data/config.yml +1 -1
- data/docker/Dockerfile +2 -2
- data/infrastructure/scripts/publish_module_version.sh +5 -1
- data/lib/brpm_script_executor.rb +18 -16
- data/lib/logging/logger_base.rb +1 -1
- data/tests/brpm_script_executor_spec.rb +4 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGU0ZTZmOTMzOTFmMjgyMzVhZjA4M2ZiM2UzZmNlMWU2ODZmMzliMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzFjMmMzOTIwOGM5NmU3YmU5OGE3ODE4OWUyMWQ0MzNkYzgwNTIxZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjBmNGY4YTQ4ZTYwNzVlZDljYjQ5MTc1OTMzOGExMmE0MjI0NjAyZjY1ODA4
|
10
|
+
MWMxNmY0ZjJiN2FjZGJjMDAxZWFhMzZlZWZhYjZlZTVmMGEyNzc1YTQ1Zjc5
|
11
|
+
YmY2ZjY5N2FmZmQ1N2IxYzQwOWNmMWY5YzZlYTJmMjdiNjM5Mzk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmQxZWEyZTNiYmYxN2Q5ZTA0ODdjZGZhZjk1NDliMzMwYmUxODUxODA0NGI3
|
14
|
+
NTM3NjhhNDUzNWJlZDllZTIxMWIxOTFmYTA2NzhiYjhjNGU4NDJjOTRkNzE5
|
15
|
+
NTFjOWM3MDIxYzU4NDNiZTBmZjNmYzFkMzZhYjgyMDc0OWJmNGQ=
|
data/config.yml
CHANGED
data/docker/Dockerfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
FROM atlashealth/ruby:1.9.3
|
2
2
|
MAINTAINER Niek Bartholomeus <niek.bartholomeus@gmail.com>
|
3
3
|
|
4
|
-
ENV BRPM_CONTENT_FRAMEWORK_VERSION 0.
|
4
|
+
ENV BRPM_CONTENT_FRAMEWORK_VERSION 1.0.0
|
5
5
|
ENV GEM_HOME /usr/lib/ruby/gems/1.9.1
|
6
6
|
|
7
7
|
RUN gem install brpm_content_framework --ignore-dependencies -v "$BRPM_CONTENT_FRAMEWORK_VERSION" && \
|
@@ -12,4 +12,4 @@ ADD . /
|
|
12
12
|
|
13
13
|
VOLUME [ "/workdir" ]
|
14
14
|
VOLUME [ "/automation_results" ]
|
15
|
-
VOLUME [ "/script_support" ]
|
15
|
+
VOLUME [ "/script_support" ]
|
@@ -19,7 +19,11 @@ if [ -f "docker/Dockerfile" ]; then
|
|
19
19
|
|
20
20
|
cd docker
|
21
21
|
|
22
|
-
|
22
|
+
if [[ "$MODULE_NAME" == brpm_content_framework ]]; then
|
23
|
+
OLD_MODULE_VERSION=$(eval "sed -n \"s=ENV BRPM_CONTENT_FRAMEWORK_VERSION \(.*\)=\1=p\" Dockerfile")
|
24
|
+
else
|
25
|
+
OLD_MODULE_VERSION=$(eval "sed -n \"s=ENV VERSION \(.*\)=\1=p\" Dockerfile")
|
26
|
+
fi
|
23
27
|
sed -i "" s/$OLD_MODULE_VERSION/$MODULE_VERSION/ Dockerfile
|
24
28
|
|
25
29
|
echo ""
|
data/lib/brpm_script_executor.rb
CHANGED
@@ -51,11 +51,11 @@ class BrpmScriptExecutor
|
|
51
51
|
if use_docker
|
52
52
|
params = params.clone # we don't want to modify the current session's params
|
53
53
|
params["SS_output_dir"] = "/workdir"
|
54
|
-
params["SS_output_file"].sub
|
54
|
+
params["SS_output_file"] = params["SS_output_file"].sub(working_path, "/workdir") if params["SS_output_file"]
|
55
55
|
params["SS_automation_results_dir"] = "/automation_results"
|
56
56
|
params["SS_script_support_path"] = "/script_support"
|
57
57
|
|
58
|
-
params["log_file"].sub
|
58
|
+
params["log_file"] = params["log_file"].sub(working_path, "/workdir") if params["log_file"]
|
59
59
|
end
|
60
60
|
|
61
61
|
BrpmAuto.log "Temporarily storing the params to #{params_path}..."
|
@@ -71,8 +71,8 @@ class BrpmScriptExecutor
|
|
71
71
|
command += " \"#{offset}\"" if offset
|
72
72
|
command += " \"#{max_records}\"" if max_records
|
73
73
|
end
|
74
|
-
BrpmAuto.
|
75
|
-
|
74
|
+
result = BrpmAuto.execute_shell(command)
|
75
|
+
|
76
76
|
else
|
77
77
|
env_vars = {}
|
78
78
|
env_vars["GEM_HOME"] = ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"
|
@@ -96,29 +96,31 @@ class BrpmScriptExecutor
|
|
96
96
|
end
|
97
97
|
|
98
98
|
BrpmAuto.log "Executing the script in a separate process..."
|
99
|
-
|
99
|
+
result = Bundler.with_clean_env { BrpmAuto.execute_shell(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}\")") }
|
100
100
|
end
|
101
101
|
|
102
102
|
FileUtils.rm(params_path) if File.exists?(params_path)
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
103
|
+
|
104
|
+
unless result["status"] == 0
|
105
|
+
if result["stdout"] and !result["stdout"].empty?
|
106
|
+
BrpmAuto.log "stdout of the executed process:"
|
107
|
+
BrpmAuto.log "-----------------------------------------------------------"
|
108
|
+
BrpmAuto.log result["stdout"]
|
109
|
+
BrpmAuto.log "-----------------------------------------------------------"
|
110
|
+
end
|
111
|
+
|
112
|
+
raise result["stderr"]
|
111
113
|
end
|
112
114
|
|
113
115
|
if automation_type == "resource_automation"
|
114
|
-
result_path = params_path.sub!("params", "result")
|
115
116
|
BrpmAuto.log "Loading the result from #{result_path} and cleaning it up..."
|
117
|
+
result_path = params_path.sub!("params", "result")
|
116
118
|
result = YAML.load_file(result_path)
|
117
119
|
FileUtils.rm result_path
|
118
120
|
|
119
121
|
result
|
120
122
|
else
|
121
|
-
|
123
|
+
true
|
122
124
|
end
|
123
125
|
|
124
126
|
rescue Exception => e
|
@@ -147,7 +149,7 @@ class BrpmScriptExecutor
|
|
147
149
|
|
148
150
|
result = execute_automation_script_internal(modul, name, params, automation_type, parent_id, offset, max_records)
|
149
151
|
if automation_type == "resource_automation"
|
150
|
-
result_file = params_file.sub
|
152
|
+
result_file = params_file.sub("params", "result")
|
151
153
|
BrpmAuto.log " Temporarily storing the result to #{result_file}..."
|
152
154
|
FileUtils.rm(result_file) if File.exists?(result_file)
|
153
155
|
File.open(result_file, "w") do |file|
|
data/lib/logging/logger_base.rb
CHANGED
@@ -52,9 +52,9 @@ describe 'BRPM Script Executor' do
|
|
52
52
|
expect(result).to be_truthy
|
53
53
|
end
|
54
54
|
|
55
|
-
|
55
|
+
xit "should execute an automation script in a docker container" do
|
56
56
|
params = get_default_params
|
57
|
-
params['output_dir'] = File.expand_path("~/tmp/brpm_content") # docker volume
|
57
|
+
params['output_dir'] = File.expand_path("~/tmp/brpm_content") # docker volume mapping only works from the current user's home directory on Mac OSX
|
58
58
|
params["execute_automation_scripts_in_docker"] = "always"
|
59
59
|
|
60
60
|
result = BrpmScriptExecutor.execute_automation_script_in_separate_process("brpm_module_test", "test_ruby", params)
|
@@ -62,11 +62,11 @@ describe 'BRPM Script Executor' do
|
|
62
62
|
expect(result).to be_truthy
|
63
63
|
end
|
64
64
|
|
65
|
-
it "should
|
65
|
+
it "should raise when executing an non-existing automation script in a separate process" do
|
66
66
|
expect{BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "xxx", get_default_params)}.to raise_exception
|
67
67
|
end
|
68
68
|
|
69
|
-
it "should
|
69
|
+
it "should raise when executing an erroneous automation script in a separate process" do
|
70
70
|
expect{BrpmScriptExecutor.execute_automation_script_in_separate_process(@module_name, "test_ruby_raises_error", get_default_params)}.to raise_exception
|
71
71
|
end
|
72
72
|
|