canzea 0.1.28 → 0.1.29
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 +2 -1
- data/lib/commands/apply-config.rb +9 -4
- data/lib/plan-step-class.rb +20 -18
- 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: da9504124bf52bfa8795481791fc25d36b5c4f66
|
4
|
+
data.tar.gz: c666e1c41850f1b425dc0228ee210174ee9348c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0600a59bd95f444939beb3a20361f7675bfba60fc2c4c4770436df80271194ccd2fd71e471860448f39f843218fdeef9d66734abbcdc01fc40e87f1e949019ca
|
7
|
+
data.tar.gz: 18d65b123e274eb84f5570b476b41c5ef2fcadf9010f507cb19757cc67f95fd0871839edc0657cf2c0ade9c45aa3b39af5d3a201daefa8a9e06ccb67c2af0cac
|
data/lib/canzea/version.rb
CHANGED
data/lib/canzea.rb
CHANGED
@@ -56,6 +56,7 @@ module Canzea
|
|
56
56
|
option nil, :role, 'Role', argument: :required
|
57
57
|
option nil, :solution, 'Solution', argument: :required
|
58
58
|
option nil, :task, 'Task', argument: :required
|
59
|
+
option nil, :step, 'Step', argument: :required
|
59
60
|
option nil, :serverBase, 'Server Base', argument: :required
|
60
61
|
option nil, :serverNumber, 'Server Number', argument: :required
|
61
62
|
option nil, :privateKey, 'Task', argument: :required
|
@@ -91,7 +92,7 @@ module Canzea
|
|
91
92
|
if (util == "apply-config")
|
92
93
|
gitRoot = opts.fetch(:gitRoot, Canzea::config[:git_repo])
|
93
94
|
ac = ApplyConfig.new
|
94
|
-
ac.do gitRoot
|
95
|
+
ac.do gitRoot, test, opts[:step], opts[:task]
|
95
96
|
end
|
96
97
|
end
|
97
98
|
|
@@ -3,7 +3,7 @@ require 'plan-step-class'
|
|
3
3
|
|
4
4
|
class ApplyConfig
|
5
5
|
|
6
|
-
def do (gitRoot)
|
6
|
+
def do (gitRoot, test = false, stepNum = nil, task = nil)
|
7
7
|
ps = PlanStep.new
|
8
8
|
|
9
9
|
# Read the configuration file and make calls out to run
|
@@ -11,13 +11,18 @@ class ApplyConfig
|
|
11
11
|
puts "Processing #{gitRoot}/configure.json"
|
12
12
|
steps = JSON.parse(File.read("#{gitRoot}/configure.json"))
|
13
13
|
|
14
|
+
index = 1
|
14
15
|
steps["steps"].each { | step |
|
15
16
|
|
16
17
|
role = step['role']
|
17
18
|
solution = step['solution']
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
puts "#{stepNum} and #{index}"
|
20
|
+
if (stepNum == nil or Integer(stepNum) == index)
|
21
|
+
puts "[#{index}] Configure for #{role} and #{solution}"
|
22
|
+
ps.runPhaseConfigure role, solution, test, (task == nil ? 1:task)
|
23
|
+
task = 1
|
24
|
+
end
|
25
|
+
index = index + 1
|
21
26
|
}
|
22
27
|
end
|
23
28
|
end
|
data/lib/plan-step-class.rb
CHANGED
@@ -72,27 +72,29 @@ class PlanStep
|
|
72
72
|
raise "#{root} does not exist!"
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
75
|
+
if (test == false)
|
76
|
+
# Register the service with Consul, if consul is ready
|
77
|
+
# If metadata.json exists, then use the information to register
|
78
|
+
cmd = "#{@basePath}/roles/#{item['role']}/#{item['solution']}/metadata.json"
|
79
|
+
if File.exist?(cmd)
|
80
|
+
md = File.read(cmd)
|
81
|
+
md = JSON.parse(md)
|
82
|
+
if (md['services'].size() > 0)
|
83
|
+
svc = md['services'][0]
|
84
|
+
adef = {"listener"=>svc['listener'], "serviceName"=>svc['name'], "tags"=>{}, "port"=>svc['port']}
|
85
|
+
puts "-- Registering #{svc['name']}"
|
86
|
+
if (test == false)
|
87
|
+
h = HelperRun.new
|
88
|
+
h.run "consul", "add_service", JSON.generate(adef)
|
89
|
+
end
|
88
90
|
end
|
89
91
|
end
|
90
|
-
end
|
91
92
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
93
|
+
envScript = "#{@basePath}/roles/#{item['role']}/#{item['solution']}/environment.json"
|
94
|
+
if File.exist?(envScript)
|
95
|
+
envPush = PrepareEnvironment.new
|
96
|
+
envPush.addToEnv "#{envScript}"
|
97
|
+
end
|
96
98
|
end
|
97
99
|
|
98
100
|
cmd = "#{@basePath}/roles/#{item['role']}/#{item['solution']}/configure.sh"
|