canzea 0.1.4 → 0.1.5
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 +4 -4
- data/lib/canzea/version.rb +1 -1
- data/lib/canzea.rb +5 -3
- data/lib/helper-run-class.rb +1 -3
- data/lib/trace-component.rb +33 -29
- data/lib/trace-runner.rb +34 -29
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c11914c5037f4956d4b89ebf4a9d3d14c4889951
|
4
|
+
data.tar.gz: fb5b5808482d8fa3d1e67fd55447088f29ca9fb2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c0e41af21397153b611d6dbba52c682a72e0a004a2174af6bdf348da423b6bd55c202845c397e3c271af4be1a124fe09a32f52d890b779e0b7b7f9947bac5cb
|
7
|
+
data.tar.gz: b85ae7fd09c0ae82f1d7969d525772989478b7c52b9ef5b50078063e12ec6dde368059a1178948cae89811ccbf0031d625f141b3975818a107f320ce25780759
|
data/lib/canzea/version.rb
CHANGED
data/lib/canzea.rb
CHANGED
@@ -59,6 +59,8 @@ module Canzea
|
|
59
59
|
|
60
60
|
run do |opts, args, cmd|
|
61
61
|
|
62
|
+
test = opts.fetch(:test, false)
|
63
|
+
|
62
64
|
if opts[:config]
|
63
65
|
file = File.read(opts[:config])
|
64
66
|
Canzea::configure JSON.parse(file)
|
@@ -87,9 +89,9 @@ module Canzea
|
|
87
89
|
if lifecycle == 'install'
|
88
90
|
puts "Running install step #{opts[:role]} #{opts[:solution]}"
|
89
91
|
ps = PlanStep.new
|
90
|
-
ps.runPhaseInstall opts[:role], opts[:solution],
|
92
|
+
ps.runPhaseInstall opts[:role], opts[:solution], test, Integer(opts.fetch(:task, 1))
|
91
93
|
|
92
|
-
if (
|
94
|
+
if (test == false)
|
93
95
|
gitRoot = opts.fetch(:gitRoot, "/opt/cloud-profile")
|
94
96
|
|
95
97
|
# write to configure the registration of the service
|
@@ -104,7 +106,7 @@ module Canzea
|
|
104
106
|
if lifecycle == 'configure'
|
105
107
|
puts "Running configure step #{opts[:role]} #{opts[:solution]}"
|
106
108
|
ps = PlanStep.new
|
107
|
-
ps.runPhaseConfigure opts[:role], opts[:solution],
|
109
|
+
ps.runPhaseConfigure opts[:role], opts[:solution], test, Integer(opts.fetch(:task, 1))
|
108
110
|
end
|
109
111
|
|
110
112
|
if lifecycle == 'wire'
|
data/lib/helper-run-class.rb
CHANGED
data/lib/trace-component.rb
CHANGED
@@ -63,49 +63,53 @@ class Worker
|
|
63
63
|
t1 = Time.now
|
64
64
|
|
65
65
|
begin
|
66
|
-
|
67
|
-
Open3.popen3(l) {|stdin, stdout, stderr, wait_thr|
|
68
|
-
pid = wait_thr.pid # pid of the started process.
|
66
|
+
workingDir = Canzea::config[:catalog_location]
|
69
67
|
|
70
|
-
|
68
|
+
puts "-- Executing: #{l} at #{workingDir}"
|
69
|
+
Dir.chdir(workingDir){
|
70
|
+
Open3.popen3(l) {|stdin, stdout, stderr, wait_thr|
|
71
|
+
pid = wait_thr.pid # pid of the started process.
|
71
72
|
|
72
|
-
|
73
|
-
while !stillOpen.empty?
|
74
|
-
fhs = select(stillOpen, nil, nil, nil)
|
75
|
-
handleIO(stillOpen, fhs[0], stdout, log_w)
|
76
|
-
handleIO(stillOpen, fhs[0], stderr, log_w)
|
77
|
-
end
|
73
|
+
log_w = StringIO.new
|
78
74
|
|
79
|
-
|
75
|
+
stillOpen = [stdout, stderr]
|
76
|
+
while !stillOpen.empty?
|
77
|
+
fhs = select(stillOpen, nil, nil, nil)
|
78
|
+
handleIO(stillOpen, fhs[0], stdout, log_w)
|
79
|
+
handleIO(stillOpen, fhs[0], stderr, log_w)
|
80
|
+
end
|
80
81
|
|
81
|
-
|
82
|
+
exit_status = wait_thr.value # wait for it to finish
|
82
83
|
|
83
|
-
|
84
|
+
log_w.close_write
|
84
85
|
|
85
|
-
|
86
|
-
puts "-- #{line}"
|
87
|
-
end
|
88
|
-
puts "-- Exit Status = #{exit_status}"
|
86
|
+
output = log_w.string
|
89
87
|
|
90
|
-
|
88
|
+
output.split(/\n/).each do | line |
|
89
|
+
puts "-- #{line}"
|
90
|
+
end
|
91
|
+
puts "-- Exit Status = #{exit_status}"
|
91
92
|
|
92
|
-
|
93
|
+
log.info("STDOUT #{output}")
|
93
94
|
|
94
|
-
|
95
|
+
log.info("Exit Status = #{exit_status}")
|
95
96
|
|
96
|
-
|
97
|
+
# if exit status is failure then exit right away
|
97
98
|
|
98
|
-
|
99
|
+
t2 = Time.now
|
99
100
|
|
100
|
-
|
101
|
+
msecs = time_diff_milli t1, t2
|
101
102
|
|
102
|
-
|
103
|
-
audit.status("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
|
104
|
-
end
|
103
|
+
audit.complete("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
|
105
|
+
if (statusIndicator)
|
106
|
+
audit.status("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
|
107
|
+
end
|
108
|
+
|
109
|
+
if exit_status.exitstatus != 0
|
110
|
+
abort()
|
111
|
+
end
|
112
|
+
}
|
109
113
|
}
|
110
114
|
rescue => exception
|
111
115
|
msecs = time_diff_milli t1, Time.now
|
data/lib/trace-runner.rb
CHANGED
@@ -4,7 +4,6 @@ require 'stringio'
|
|
4
4
|
require 'logger'
|
5
5
|
require 'audit'
|
6
6
|
|
7
|
-
|
8
7
|
def time_diff_milli(start, finish)
|
9
8
|
(finish - start) * 1000.0
|
10
9
|
end
|
@@ -36,48 +35,54 @@ class RunnerWorker
|
|
36
35
|
|
37
36
|
t1 = Time.now
|
38
37
|
|
39
|
-
|
40
|
-
|
38
|
+
workingDir = Canzea::config[:catalog_location]
|
39
|
+
|
40
|
+
puts "-- Executing: #{l} at #{workingDir}"
|
41
|
+
Dir.chdir(workingDir){
|
42
|
+
|
43
|
+
Open3.popen3(ENV, l) {|stdin, stdout, stderr, wait_thr|
|
44
|
+
pid = wait_thr.pid # pid of the started process.
|
41
45
|
|
42
|
-
|
46
|
+
log_w = StringIO.new
|
43
47
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
stillOpen = [stdout, stderr]
|
49
|
+
while !stillOpen.empty?
|
50
|
+
fhs = select(stillOpen, nil, nil, nil)
|
51
|
+
handleIO(stillOpen, fhs[0], stdout, log_w)
|
52
|
+
handleIO(stillOpen, fhs[0], stderr, log_w)
|
53
|
+
end
|
50
54
|
|
51
|
-
|
55
|
+
exit_status = wait_thr.value # wait for it to finish
|
52
56
|
|
53
|
-
|
57
|
+
log_w.close_write
|
54
58
|
|
55
|
-
|
59
|
+
output = log_w.string
|
56
60
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
+
output.split(/\n/).each do | line |
|
62
|
+
puts "-- #{line}"
|
63
|
+
end
|
64
|
+
puts "-- Exit Status = #{exit_status}"
|
61
65
|
|
62
|
-
|
66
|
+
log.info("STDOUT #{output}")
|
63
67
|
|
64
|
-
|
68
|
+
log.info("Exit Status = #{exit_status}")
|
65
69
|
|
66
|
-
|
70
|
+
# if exit status is failure then exit right away
|
67
71
|
|
68
|
-
|
72
|
+
t2 = Time.now
|
69
73
|
|
70
|
-
|
74
|
+
msecs = time_diff_milli t1, t2
|
71
75
|
|
72
|
-
|
76
|
+
audit.complete("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
|
73
77
|
|
74
|
-
|
75
|
-
|
76
|
-
|
78
|
+
if (statusIndicator)
|
79
|
+
audit.status("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
|
80
|
+
end
|
77
81
|
|
78
|
-
|
79
|
-
|
80
|
-
|
82
|
+
if exit_status.exitstatus != 0
|
83
|
+
abort()
|
84
|
+
end
|
85
|
+
}
|
81
86
|
}
|
82
87
|
|
83
88
|
lines += 1
|