brpm_content_framework 0.2.18 → 0.2.19
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/lib/brpm_script_executor.rb +17 -18
- data/lib/module_installer.rb +2 -2
- data/tests/brpm_script_executor_spec.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjQ0NmNiYWVkNjcyYTU4MTgwNDhjODM1ZjEwMjkzN2VjY2EyYTllMg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZmZiMGUyNTY1OTE5YjgwNWM5YTA5NTRhY2NiZGFkYmIzMGZhMTBkMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjY0NWYzM2JiMTY2OTI2M2Q0OTQ5YjI1YTU4ZmQzOThkN2RmODMyZTkyODY3
|
10
|
+
OGMzYzg1YmNhZmZiM2YzZTZhYWRhOTVhNzQzNDhkMzQ1NTg5MjA0OTE5YThj
|
11
|
+
YWM0OGExOGZkNTdjZDRiZDIxMTNmMWE2YTQyNzJjOTliNGU2MTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDA0NTljY2YzN2M1M2I1YzEwZGNhOTBjOWVmNTNiN2YzYWYyODM2ZjVjZDFk
|
14
|
+
YTlmNWYxMGU3YzQzMzkzYWYyYjAzYzllMDMyMWNlMDI2Yzg4ZTM5OTIzMTRm
|
15
|
+
ZWZmNGMyOWE4ODRlNzZiNDcwZGM0NGIwOGZmZmM2OTJiYzE5OGI=
|
data/config.yml
CHANGED
data/lib/brpm_script_executor.rb
CHANGED
@@ -6,19 +6,28 @@ class BrpmScriptExecutor
|
|
6
6
|
private_class_method :new
|
7
7
|
|
8
8
|
class << self
|
9
|
-
def
|
10
|
-
|
9
|
+
def execute_automation_script(modul, name, params, in_separate_process = nil)
|
10
|
+
execute_automation_script_internal(modul, name, params, "automation", in_separate_process)
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def execute_resource_automation_script(modul, name, params, in_separate_process = nil, parent_id, offset, max_records)
|
14
|
+
execute_automation_script_internal(modul, name, params, "resource_automation", in_separate_process, parent_id, offset, max_records)
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
17
|
+
def execute_automation_script_internal(modul, name, params, automation_type, in_separate_process = nil, parent_id = nil, offset = nil, max_records = nil)
|
18
18
|
BrpmAuto.setup(params)
|
19
19
|
BrpmAuto.log ""
|
20
|
-
BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in a separate process..."
|
21
20
|
|
21
|
+
if in_separate_process || BrpmAuto.params["execute_automations_in_separate_process"]
|
22
|
+
BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in a separate process..."
|
23
|
+
execute_automation_script_in_separate_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
|
24
|
+
else
|
25
|
+
BrpmAuto.log "Executing #{automation_type} '#{name}' from module '#{modul}' in-process..."
|
26
|
+
execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def execute_automation_script_in_separate_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
|
22
31
|
env_vars = {}
|
23
32
|
env_vars["JRUBY_OPTS"] = "-Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF" # improve jvm startup time (see http://rexchung.com/2013/08/02/speed-up-jruby-rails-startup-time/)
|
24
33
|
env_vars["GEM_HOME"] = ENV["BRPM_CONTENT_HOME"] || "#{ENV["BRPM_HOME"]}/modules"
|
@@ -99,7 +108,7 @@ class BrpmScriptExecutor
|
|
99
108
|
load File.expand_path("#{File.dirname(__FILE__)}/../infrastructure/create_output_file.rb")
|
100
109
|
end
|
101
110
|
|
102
|
-
result =
|
111
|
+
result = execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id, offset, max_records)
|
103
112
|
if automation_type == "resource_automation"
|
104
113
|
result_file = "#{File.dirname(params_file)}/result_#{Process.pid}.yml"
|
105
114
|
BrpmAuto.log " Temporarily storing the result to #{result_file}..."
|
@@ -110,18 +119,8 @@ class BrpmScriptExecutor
|
|
110
119
|
end
|
111
120
|
end
|
112
121
|
|
113
|
-
def
|
114
|
-
execute_automation_script_internal(modul, name, params, "automation")
|
115
|
-
end
|
116
|
-
|
117
|
-
def execute_resource_automation_script(modul, name, params, parent_id, offset, max_records)
|
118
|
-
execute_automation_script_internal(modul, name, params, "resource_automation", parent_id, offset, max_records)
|
119
|
-
end
|
120
|
-
|
121
|
-
def execute_automation_script_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
|
122
|
+
def execute_automation_script_in_same_process_internal(modul, name, params, automation_type, parent_id = nil, offset = nil, max_records = nil)
|
122
123
|
begin
|
123
|
-
BrpmAuto.setup(params)
|
124
|
-
|
125
124
|
BrpmAuto.log ""
|
126
125
|
BrpmAuto.log ">>>>>>>>>>>>>> START #{automation_type} #{modul} #{name}"
|
127
126
|
start_time = Time.now
|
data/lib/module_installer.rb
CHANGED
@@ -539,7 +539,7 @@ EOR
|
|
539
539
|
template += <<EOR
|
540
540
|
require "\#{ENV["BRPM_CONTENT_HOME"] || "\#{ENV["BRPM_HOME"]}/modules"}/gems/brpm_content_framework-\#{params["framework_version"] || "latest"}/lib/brpm_script_executor.rb"
|
541
541
|
|
542
|
-
BrpmScriptExecutor.
|
542
|
+
BrpmScriptExecutor.execute_automation_script("#{module_name}", "#{auto_script_name}", params)
|
543
543
|
EOR
|
544
544
|
|
545
545
|
elsif automation_type == "ResourceAutomation"
|
@@ -548,7 +548,7 @@ EOR
|
|
548
548
|
load "\#{ENV["BRPM_CONTENT_HOME"] || "\#{ENV["BRPM_HOME"]}/modules"}/gems/brpm_content_framework-\#{params["framework_version"] || "latest"}/lib/brpm_script_executor.rb"
|
549
549
|
|
550
550
|
def execute(script_params, parent_id, offset, max_records)
|
551
|
-
BrpmScriptExecutor.
|
551
|
+
BrpmScriptExecutor.execute_resource_automation_script("#{module_name}", "#{auto_script_name}", script_params, parent_id, offset, max_records)
|
552
552
|
end
|
553
553
|
EOR
|
554
554
|
end
|
@@ -35,7 +35,7 @@ describe 'BRPM Script Executor' do
|
|
35
35
|
# Note: the following tests will run the automation scripts in a separate process and will therefore use an already installed brpm_content_framework module,
|
36
36
|
# either the version from their Gemfile/Gemfile.lock or the latest, but not the one from source code
|
37
37
|
it "should execute an automation script in a separate process inside a bundler context" do
|
38
|
-
result = BrpmScriptExecutor.
|
38
|
+
result = BrpmScriptExecutor.execute_automation_script("brpm_module_test", "test_ruby", get_default_params, true)
|
39
39
|
|
40
40
|
expect(result).to be_truthy
|
41
41
|
end
|
@@ -46,22 +46,22 @@ describe 'BRPM Script Executor' do
|
|
46
46
|
gemfile_path = "#{module_gem_path}/Gemfile"
|
47
47
|
|
48
48
|
FileUtils.move(gemfile_path, "#{gemfile_path}_tmp")
|
49
|
-
result = BrpmScriptExecutor.
|
49
|
+
result = BrpmScriptExecutor.execute_automation_script(@module_name, "test_ruby", get_default_params, true)
|
50
50
|
FileUtils.move("#{gemfile_path}_tmp", gemfile_path)
|
51
51
|
|
52
52
|
expect(result).to be_truthy
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should return false when executing an non-existing automation script in a separate process" do
|
56
|
-
expect{BrpmScriptExecutor.
|
56
|
+
expect{BrpmScriptExecutor.execute_automation_script(@module_name, "xxx", get_default_params, true)}.to raise_exception
|
57
57
|
end
|
58
58
|
|
59
59
|
it "should return false when executing an erroneous automation script in a separate process" do
|
60
|
-
expect{BrpmScriptExecutor.
|
60
|
+
expect{BrpmScriptExecutor.execute_automation_script(@module_name, "test_ruby_raises_error", get_default_params, true)}.to raise_exception
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should execute a resource automation script in a separate process" do
|
64
|
-
result = BrpmScriptExecutor.
|
64
|
+
result = BrpmScriptExecutor.execute_resource_automation_script(@module_name, "test_resource", get_default_params, true, nil, 0, 10)
|
65
65
|
|
66
66
|
expect(result.count).to eql(3)
|
67
67
|
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.
|
4
|
+
version: 0.2.19
|
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-
|
11
|
+
date: 2015-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|