canzea 0.1.123 → 0.1.124
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canzea.rb +5 -1
- data/lib/canzea/version.rb +1 -1
- data/lib/commands/prepare-plan.rb +25 -3
- data/lib/commands/remote-run.rb +15 -0
- data/lib/ssh-base-cmd-class.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 791e4b6da51ce87c852ae8fc80b3f9c0fece25e6
|
4
|
+
data.tar.gz: 3b441945f2f8fb950b67c1a025cdc8f8e9379ac8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8d2b677c3e75b8e665b35f563a27e5eefb873f0337403ef5cb88163725914bfa426ed85a98eb5ef58f8528d2abebfd8bdd278a499cb908458f0248f30e75ce
|
7
|
+
data.tar.gz: ea0c84d56601978158f8aa92c336fa25fd9c1e8d783bd2be999c665272a6cc001c14fdc06d18587d3f6de6686380591b278c9b766aa722f0069314d69c1cbf62
|
data/lib/canzea.rb
CHANGED
@@ -147,7 +147,11 @@ module Canzea
|
|
147
147
|
end
|
148
148
|
if (util == "prepare-plan")
|
149
149
|
ac = PreparePlan.new
|
150
|
-
ac.do opts[:blueprint], opts[:segment], opts[:step], test, opts[:privateKey], opts[:serverBase], opts[:serverNumber]
|
150
|
+
ac.do opts[:blueprint], opts[:segment], opts[:step], opts[:task], test, opts[:privateKey], opts[:serverBase], opts[:serverNumber]
|
151
|
+
end
|
152
|
+
if (util == "prepare-patch")
|
153
|
+
ac = PreparePlan.new
|
154
|
+
ac.doPatch opts.fetch(:args, '{}'), test, opts[:privateKey], opts[:serverBase], opts[:serverNumber]
|
151
155
|
end
|
152
156
|
if (util == "apply-config")
|
153
157
|
gitRoot = opts.fetch(:gitRoot, Canzea::config[:git_repo])
|
data/lib/canzea/version.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'json'
|
2
|
+
require 'base64'
|
2
3
|
require 'commands/add-env'
|
3
4
|
require 'plan-step-class'
|
4
5
|
require 'yaml'
|
5
6
|
require 'canzea/config'
|
7
|
+
require 'commands/remote-run'
|
6
8
|
|
7
9
|
class PreparePlan
|
8
10
|
def initialize ()
|
@@ -10,8 +12,21 @@ class PreparePlan
|
|
10
12
|
@basePath = "#{Pathname.new(Canzea::config[:catalog_location]).realpath}"
|
11
13
|
end
|
12
14
|
|
15
|
+
def doPatch (params, test, privateKey, serverBase, serverNumber)
|
16
|
+
|
17
|
+
publicIp = File.read("#{Canzea::config[:pwd]}/vps-#{serverBase}-#{serverNumber}.json")
|
18
|
+
publicIp.strip!
|
19
|
+
|
20
|
+
patches = Base64.decode64(params['patches'])
|
21
|
+
params['patches'] = JSON.parse(patches)
|
22
|
+
|
23
|
+
params['patches'].each do | patch |
|
24
|
+
RemoteRun.new.doCommand publicIp, privateKey, patch.command
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
13
28
|
# Read the blueprint instructions and prepare plan for a particular segment
|
14
|
-
def do (blueprint, segment, step, test, privateKey, serverBase, serverNumber)
|
29
|
+
def do (blueprint, segment, step, task, test, privateKey, serverBase, serverNumber)
|
15
30
|
planStep = PlanStep.new
|
16
31
|
|
17
32
|
log "Processing configure.json for #{segment} in #{blueprint} from #{@basePath}"
|
@@ -30,10 +45,17 @@ class PreparePlan
|
|
30
45
|
log "[#{index.to_s.rjust(2, "0")}] #{item} SKIPPING"
|
31
46
|
else
|
32
47
|
log "[#{index.to_s.rjust(2, "0")}] #{item}"
|
48
|
+
publicIp = File.read("#{Canzea::config[:pwd]}/vps-#{serverBase}-#{serverNumber}.json")
|
49
|
+
publicIp.strip!
|
33
50
|
if (test == false)
|
34
|
-
|
35
|
-
|
51
|
+
if (task == nil)
|
52
|
+
RemoteRun.new.do publicIp, privateKey, parts[1], parts[2], index.to_s.rjust(2, "0")
|
53
|
+
else
|
54
|
+
RemoteRun.new.doTask publicIp, privateKey, parts[1], parts[2], task, index.to_s.rjust(2, "0")
|
55
|
+
end
|
36
56
|
# Keep track of what we have done; parsing the response and looking at the JSON
|
57
|
+
else
|
58
|
+
RemoteRun.new.test publicIp, privateKey, parts[1], parts[2], index.to_s.rjust(2, "0")
|
37
59
|
end
|
38
60
|
end
|
39
61
|
index = index + 1
|
data/lib/commands/remote-run.rb
CHANGED
@@ -4,8 +4,23 @@ require "pathname"
|
|
4
4
|
require "ssh-base-cmd-class"
|
5
5
|
|
6
6
|
class RemoteRun
|
7
|
+
def doTask(publicIp, privateKey, role, solution, task, ref="")
|
8
|
+
remote = RemoteCall.new
|
9
|
+
remote.exec publicIp, privateKey, "canzea --lifecycle=install --role=#{role} --task=#{task} --solution=#{solution}", ref
|
10
|
+
end
|
11
|
+
|
7
12
|
def do(publicIp, privateKey, role, solution, ref="")
|
8
13
|
remote = RemoteCall.new
|
9
14
|
remote.exec publicIp, privateKey, "canzea --lifecycle=install --role=#{role} --solution=#{solution}", ref
|
10
15
|
end
|
16
|
+
|
17
|
+
def doCommand(publicIp, privateKey, command, ref="")
|
18
|
+
remote = RemoteCall.new
|
19
|
+
remote.exec publicIp, privateKey, command, ref
|
20
|
+
end
|
21
|
+
|
22
|
+
def test(publicIp, privateKey, role, solution, ref="")
|
23
|
+
remote = RemoteCall.new
|
24
|
+
remote.exec publicIp, privateKey, "canzea --lifecycle=install --role=#{role} --solution=#{solution} --test", ref
|
25
|
+
end
|
11
26
|
end
|
data/lib/ssh-base-cmd-class.rb
CHANGED
@@ -26,6 +26,7 @@ class RemoteCall
|
|
26
26
|
channel.env("VAULT_TOKEN", ENV['VAULT_TOKEN'])
|
27
27
|
channel.env("CONSUL_URL", ENV['CONSUL_URL'])
|
28
28
|
channel.env("WORK_DIR", ENV['WORK_DIR'])
|
29
|
+
channel.env("ES_REF", ref)
|
29
30
|
channel.exec(cmd) do |ch, success|
|
30
31
|
abort "could not execute command" unless success
|
31
32
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canzea
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.124
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Canzea Technologies
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|