brpm_content_framework 0.2.30 → 0.2.31

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
- MWJmZWY0ZWYzZjdiYWQzNjBmMTM5M2ZjNGNlYmU0OGRlNDBjMWU0Mw==
4
+ ZTEzY2UxYjA2ZWNhZGM2NTRkMzkyNTFkMDFlYjk3NjVkYzFmYmM4Mg==
5
5
  data.tar.gz: !binary |-
6
- M2RiNzU0N2E1NGZjM2M5OWM5NDg2MmYyNGY3YjQ3Yjc0NDY5NjdkYQ==
6
+ YTI3MWZmZmIwZGVmYmJkMzYyMmZhMWFlMzQwOWY2NzdiMmFkM2NiYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDA5Y2JlN2Y0ZDc5OTJiYmM5MzEwMmVmNTIyZTMxNjZlMGEwMTUwMjhhYWM1
10
- MzFjNzQ5ZjFkMTE3NmY2ZTBkYmZlYjRiM2FmYjQ2MmQyMGZmNWNiNTk0Mjgy
11
- MDNjMzY5YmQ1MDgyNDQzYjFiNjE1OTU4OTM4MzVhMWY4ZGNkMTE=
9
+ MzAzMmNlMTAxZjhlMDU5ODg0ZmY3YzVhYjhjNzJjMjhmYThmNjM4OWE4ZWNl
10
+ MjBhN2YwMDE4OWM1Njg1Y2FkM2QwYmJkNjUyYzA3NTM4MzE5Y2NjOWQwNTkz
11
+ Y2IxZGM1NDFmMWYzY2ZjZDNhMjhiZDMyYmUzYWFlZGI2ODQ2YTQ=
12
12
  data.tar.gz: !binary |-
13
- YWQ4YmM0MmIwMDEwZDhkOWIzZTEyOGM0MWRmNWJiY2NkYjYxYTc4YTc5NTIy
14
- MmVlYTBlYTYxYmE1NjVjYjliNWI0MTQ3ZWQ0NDE5MGRkMWMyNmQ4MDdkNTQ4
15
- NjA3MjRjNWY0ODkxNTRkOTVkODY0MTdlYjViNjAyNzExZTEzOTA=
13
+ MzY1NmE4YjdhYmE5MGI4MGVhMWI4NjAzNzUzNmM2MGVjZmY4MzFkOWQ0NmE3
14
+ NjIyMjlkNGJkOWI0MTJjZjlkNDJmZGEyY2ZhYTQyYWJlZjcxYmZjNDRjYTk4
15
+ ZGQ4MTE0ZmYyMjc4Njk5YmNlODg0MzI2NWZkY2NjMTE3NmFhZWM=
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.30
1
+ version: 0.2.31
2
2
 
3
3
  author: Niek Bartholomeus
4
4
  email: niek.bartholomeus@gmail.com
@@ -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.29
4
+ ENV BRPM_CONTENT_FRAMEWORK_VERSION 0.2.31
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" && \
@@ -11,3 +11,4 @@ RUN gem install brpm_content_framework --ignore-dependencies -v "$BRPM_CONTENT_F
11
11
  ADD . /
12
12
 
13
13
  VOLUME [ "/workdir" ]
14
+ VOLUME [ "/automation_results" ]
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  module_name = ENV["MODULE"]
3
3
  automation_script_name = ARGV[0]
4
- params_file = "/workdir/#{ARGV[1]}"
4
+ params_path = ARGV[1]
5
5
  automation_type = ARGV[2]
6
6
  parent_id = ARGV.size > 3 ? ARGV[3] : nil
7
7
  offset = ARGV.size > 4 ? ARGV[4] : nil
@@ -17,4 +17,4 @@ if File.exists?(gemfile_path)
17
17
  end
18
18
 
19
19
  require 'brpm_script_executor'
20
- BrpmScriptExecutor.execute_automation_script_from_other_process(module_name, automation_script_name, params_file, automation_type, parent_id, offset, max_records)
20
+ BrpmScriptExecutor.execute_automation_script_from_other_process(module_name, automation_script_name, params_path, automation_type, parent_id, offset, max_records)
@@ -74,6 +74,8 @@ class BrpmAuto
74
74
  SS_project_server_id
75
75
  )
76
76
  end
77
+
78
+ @params
77
79
  end
78
80
 
79
81
  def load_server_params
@@ -29,23 +29,33 @@ class BrpmScriptExecutor
29
29
  raise "Automation type #{automation_type} is not supported."
30
30
  end
31
31
 
32
- case params["execute_automation_scripts_in_docker"]
32
+ case BrpmAuto.params["execute_automation_scripts_in_docker"]
33
33
  when "always"
34
34
  use_docker = true
35
35
  when "if_docker_image_exists"
36
- output = exec("docker pull bmcrlm/#{modul}:#{module_version}")
37
- use_docker = (output =~ /Image is up to date for/)
36
+ BrpmAuto.log "Checking if a docker image exists for bmcrlm/#{modul}:#{module_version}..."
37
+ output = `docker history -q bmcrlm/#{modul}:#{module_version} 2>&1 >/dev/null`
38
+ if output.empty?
39
+ use_docker = true
40
+ else
41
+ BrpmAuto.log "The image doesn't exist locally, checking if we can pull it from the Docker Hub..."
42
+ output = `docker pull bmcrlm/#{modul}:#{module_version}`
43
+ use_docker = (output =~ /Image is up to date for/)
44
+ end
38
45
  else
39
46
  use_docker = false
40
47
  end
41
48
 
42
- working_path = File.expand_path(params["SS_output_dir"] || params["output_dir"] || Dir.pwd)
49
+ working_path = File.expand_path(BrpmAuto.params.output_dir)
43
50
  params_file = "params_#{params["SS_run_key"] || params["run_key"] || "000"}.yml"
44
51
  params_path = "#{working_path}/#{params_file}"
52
+ automation_results_path = params["SS_automation_results_dir"] || working_path
45
53
 
46
54
  if use_docker
47
- params["SS_output_dir"] = "/workdir" if params.has_key?("SS_output_dir")
48
- params["output_dir"] = "/workdir" if params.has_key?("output_dir")
55
+ params["SS_output_dir"] = "/workdir"
56
+ params["SS_output_file"].sub!(working_path, "/workdir")
57
+
58
+ params["SS_automation_results_dir"] = "/automation_results"
49
59
  end
50
60
 
51
61
  BrpmAuto.log "Temporarily storing the params to #{params_path}..."
@@ -55,12 +65,13 @@ class BrpmScriptExecutor
55
65
 
56
66
  if use_docker
57
67
  BrpmAuto.log "Executing the script in a docker container..."
58
- command = "docker run -v #{working_path}:/workdir --rm bmcrlm/#{modul}:#{module_version} /docker_execute_automation \"#{name}\" \"#{params_file}\" \"#{automation_type}\""
68
+ command = "docker run -v #{working_path}:/workdir -v #{automation_results_path}:/automation_results --rm bmcrlm/#{modul}:#{module_version} /docker_execute_automation \"#{name}\" \"/workdir/#{params_file}\" \"#{automation_type}\""
59
69
  if automation_type == "resource_automation"
60
70
  command += " \"#{parent_id}\"" if parent_id
61
71
  command += " \"#{offset}\"" if offset
62
72
  command += " \"#{max_records}\"" if max_records
63
73
  end
74
+ BrpmAuto.log command
64
75
  exec(command)
65
76
  else
66
77
  env_vars = {}
@@ -94,7 +94,7 @@ class Params < ParamsBase
94
94
  @run_key = params["SS_run_key"] || params["run_key"]
95
95
 
96
96
  if params["SS_automation_results_dir"]
97
- @home_dir = params["SS_automation_results_dir"].sub("automation_results", "")
97
+ @home_dir = params["SS_automation_results_dir"].sub("/automation_results", "")
98
98
  else
99
99
  @home_dir = params["home_dir"] || Dir.pwd
100
100
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.30
4
+ version: 0.2.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-28 00:00:00.000000000 Z
11
+ date: 2015-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-ssh