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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGE3ODVjYmZiOTE3MzYwNTE0MjIwZWUzN2NkNDk5MGZlN2IwODE5YQ==
4
+ MGU0ZTZmOTMzOTFmMjgyMzVhZjA4M2ZiM2UzZmNlMWU2ODZmMzliMA==
5
5
  data.tar.gz: !binary |-
6
- MDYzNWYwZjQyNjAzYzNhMDgxNmQ3ZDdmYzg3Y2Y3MzcwYjUwZTc5ZA==
6
+ MzFjMmMzOTIwOGM5NmU3YmU5OGE3ODE4OWUyMWQ0MzNkYzgwNTIxZA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MzkxMDAyMDA4NGNmNTE0ZGY2ZjgyNTE5NDc3YjBjMDlkYmJiYzFhZWE3YjY5
10
- ZTRkOGFhMjc1OGVlYzQ1ZWM5NDUyZTY0NzZiN2JmNjhiZmI1MjNhYWRkNWQ4
11
- YWZkZDIyYzg2Mjg1YTU0NjYwZDRmZTBmNmNiZjIwMjNhYmRlNWQ=
9
+ ZjBmNGY4YTQ4ZTYwNzVlZDljYjQ5MTc1OTMzOGExMmE0MjI0NjAyZjY1ODA4
10
+ MWMxNmY0ZjJiN2FjZGJjMDAxZWFhMzZlZWZhYjZlZTVmMGEyNzc1YTQ1Zjc5
11
+ YmY2ZjY5N2FmZmQ1N2IxYzQwOWNmMWY5YzZlYTJmMjdiNjM5Mzk=
12
12
  data.tar.gz: !binary |-
13
- OTRlZDMyNzk0Yjk0OTFmNzc0ZjhmOTk3M2Q1NmQwYzJiYWRjNGU2Y2NiYzc2
14
- MmE4Njk4ZmM1ZDc3NTU3ZDg1M2VmYTdmMmY2YTMyMDE2NWJhNzI3Mzc1YzRl
15
- NTliNWMwZDQyOWVjOGRkYTI1MzBmNDFiMWE0NDQyMmY5NmIxMzk=
13
+ MmQxZWEyZTNiYmYxN2Q5ZTA0ODdjZGZhZjk1NDliMzMwYmUxODUxODA0NGI3
14
+ NTM3NjhhNDUzNWJlZDllZTIxMWIxOTFmYTA2NzhiYjhjNGU4NDJjOTRkNzE5
15
+ NTFjOWM3MDIxYzU4NDNiZTBmZjNmYzFkMzZhYjgyMDc0OWJmNGQ=
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.33
1
+ version: 0.2.34
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
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.2.31
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
- OLD_MODULE_VERSION=$(eval "sed -n \"s=ENV VERSION \(.*\)=\1=p\" Dockerfile")
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 ""
@@ -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!(working_path, "/workdir") if params["SS_output_file"]
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!(working_path, "/workdir") if params["log_file"]
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.log command
75
- return_value = system(command)
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
- return_value = Bundler.clean_system(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}\")")
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
- if return_value.nil?
104
- message = "The process that executed the automation script returned with 'Command execution failed'."
105
- BrpmAuto.log_error message
106
- raise message
107
- elsif return_value == false
108
- message = "The process that executed the automation script returned with non-zero exit code: #{$?.exitstatus}"
109
- BrpmAuto.log_error message
110
- raise message
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
- return_value
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!("params", "result")
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|
@@ -28,7 +28,7 @@ class LoggerBase
28
28
  def log_error(message)
29
29
  log ""
30
30
  log "******** ERROR ********"
31
- log "An error has occurred"
31
+ log "An error has occurred:"
32
32
  log "#{message}"
33
33
  log "***********************"
34
34
  log ""
@@ -52,9 +52,9 @@ describe 'BRPM Script Executor' do
52
52
  expect(result).to be_truthy
53
53
  end
54
54
 
55
- it "should execute an automation script in a docker container" do
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 mappong only works from the current user's home directory on Mac OSX
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 return false when executing an non-existing automation script in a separate process" do
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 return false when executing an erroneous automation script in a separate process" do
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
 
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.33
4
+ version: 0.2.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus