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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f59ee9ccca375b3964c6a481ed764df99d3c554
4
- data.tar.gz: deca6f5de7a10226dc6ecbde0264362d02a2a4e2
3
+ metadata.gz: c11914c5037f4956d4b89ebf4a9d3d14c4889951
4
+ data.tar.gz: fb5b5808482d8fa3d1e67fd55447088f29ca9fb2
5
5
  SHA512:
6
- metadata.gz: 8d9b61001757534ce4e9a2190cb854add6f68a3ed10375411a2a65b8cd405c87019711184e749f29276207d2cf0b45687596f9173673dc70e1af259d9d0261f2
7
- data.tar.gz: 268867efef123b8be8b63ca4503ff5fd9e08dd1feea7d9eda53be6ddb1fe5053dcafaac5bac1b3ef7ce2546e6eb44a2d6e33d1efbd8c121253a6a76fed0268fa
6
+ metadata.gz: 4c0e41af21397153b611d6dbba52c682a72e0a004a2174af6bdf348da423b6bd55c202845c397e3c271af4be1a124fe09a32f52d890b779e0b7b7f9947bac5cb
7
+ data.tar.gz: b85ae7fd09c0ae82f1d7969d525772989478b7c52b9ef5b50078063e12ec6dde368059a1178948cae89811ccbf0031d625f141b3975818a107f320ce25780759
@@ -1,3 +1,3 @@
1
1
  module Canzea
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
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], opts[:test], Integer(opts.fetch(:task, 1))
92
+ ps.runPhaseInstall opts[:role], opts[:solution], test, Integer(opts.fetch(:task, 1))
91
93
 
92
- if (opts[:test] == false)
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], opts[:test], Integer(opts.fetch(:task, 1))
109
+ ps.runPhaseConfigure opts[:role], opts[:solution], test, Integer(opts.fetch(:task, 1))
108
110
  end
109
111
 
110
112
  if lifecycle == 'wire'
@@ -22,9 +22,7 @@ class HelperRun
22
22
 
23
23
  type = "ruby"
24
24
 
25
- params = JSON.parse(parameters);
26
-
27
- parameters = JSON.generate(params)
25
+ parameters = JSON.generate(parameters)
28
26
 
29
27
  envPush = PrepareEnvironment.new
30
28
 
@@ -63,49 +63,53 @@ class Worker
63
63
  t1 = Time.now
64
64
 
65
65
  begin
66
- puts "-- Executing: #{l}"
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
- log_w = StringIO.new
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
- stillOpen = [stdout, stderr]
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
- exit_status = wait_thr.value # wait for it to finish
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
- log_w.close_write
82
+ exit_status = wait_thr.value # wait for it to finish
82
83
 
83
- output = log_w.string
84
+ log_w.close_write
84
85
 
85
- output.split(/\n/).each do | line |
86
- puts "-- #{line}"
87
- end
88
- puts "-- Exit Status = #{exit_status}"
86
+ output = log_w.string
89
87
 
90
- log.info("STDOUT #{output}")
88
+ output.split(/\n/).each do | line |
89
+ puts "-- #{line}"
90
+ end
91
+ puts "-- Exit Status = #{exit_status}"
91
92
 
92
- log.info("Exit Status = #{exit_status}")
93
+ log.info("STDOUT #{output}")
93
94
 
94
- # if exit status is failure then exit right away
95
+ log.info("Exit Status = #{exit_status}")
95
96
 
96
- t2 = Time.now
97
+ # if exit status is failure then exit right away
97
98
 
98
- msecs = time_diff_milli t1, t2
99
+ t2 = Time.now
99
100
 
100
- audit.complete("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
101
+ msecs = time_diff_milli t1, t2
101
102
 
102
- if (statusIndicator)
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
- if exit_status.exitstatus != 0
107
- abort()
108
- end
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
- Open3.popen3(ENV, l) {|stdin, stdout, stderr, wait_thr|
40
- pid = wait_thr.pid # pid of the started process.
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
- log_w = StringIO.new
46
+ log_w = StringIO.new
43
47
 
44
- stillOpen = [stdout, stderr]
45
- while !stillOpen.empty?
46
- fhs = select(stillOpen, nil, nil, nil)
47
- handleIO(stillOpen, fhs[0], stdout, log_w)
48
- handleIO(stillOpen, fhs[0], stderr, log_w)
49
- end
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
- exit_status = wait_thr.value # wait for it to finish
55
+ exit_status = wait_thr.value # wait for it to finish
52
56
 
53
- log_w.close_write
57
+ log_w.close_write
54
58
 
55
- output = log_w.string
59
+ output = log_w.string
56
60
 
57
- output.split(/\n/).each do | line |
58
- puts "-- #{line}"
59
- end
60
- puts "-- Exit Status = #{exit_status}"
61
+ output.split(/\n/).each do | line |
62
+ puts "-- #{line}"
63
+ end
64
+ puts "-- Exit Status = #{exit_status}"
61
65
 
62
- log.info("STDOUT #{output}")
66
+ log.info("STDOUT #{output}")
63
67
 
64
- log.info("Exit Status = #{exit_status}")
68
+ log.info("Exit Status = #{exit_status}")
65
69
 
66
- # if exit status is failure then exit right away
70
+ # if exit status is failure then exit right away
67
71
 
68
- t2 = Time.now
72
+ t2 = Time.now
69
73
 
70
- msecs = time_diff_milli t1, t2
74
+ msecs = time_diff_milli t1, t2
71
75
 
72
- audit.complete("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
76
+ audit.complete("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
73
77
 
74
- if (statusIndicator)
75
- audit.status("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
76
- end
78
+ if (statusIndicator)
79
+ audit.status("#{lines + 1}", l.chomp, exit_status.exitstatus, msecs, output)
80
+ end
77
81
 
78
- if exit_status.exitstatus != 0
79
- abort()
80
- end
82
+ if exit_status.exitstatus != 0
83
+ abort()
84
+ end
85
+ }
81
86
  }
82
87
 
83
88
  lines += 1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canzea
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Canzea Technologies