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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ad2a2463592942ab8c6dd33adfc62b6aa3479ca
4
- data.tar.gz: 40708c34f547b1f2f6781865f9f0963f33dcfc7d
3
+ metadata.gz: 791e4b6da51ce87c852ae8fc80b3f9c0fece25e6
4
+ data.tar.gz: 3b441945f2f8fb950b67c1a025cdc8f8e9379ac8
5
5
  SHA512:
6
- metadata.gz: 06616c429e2c789109412bb6988320c2a83f4857be5e90d45d60dab12c2b3b19b5bfb949c9ff08af6a7394185752ddf801dbfe4d27924d1fc4f8475a69a38170
7
- data.tar.gz: 8aab8ad6a276794bc43c0864357beb69e2565f99cf4cd5f156ad94c592df627ea4d55e80bbb0009438e6032218bc7e3959c76b776da12d44eb57d4fc67eae626
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])
@@ -1,3 +1,3 @@
1
1
  module Canzea
2
- VERSION = "0.1.123"
2
+ VERSION = "0.1.124"
3
3
  end
@@ -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
- publicIp = File.read("#{Canzea::config[:pwd]}/vps-#{serverBase}-#{serverNumber}.json")
35
- RemoteRun.new.do publicIp, privateKey, parts[1], parts[2], index.to_s.rjust(2, "0")
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
@@ -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
@@ -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.123
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-03 00:00:00.000000000 Z
11
+ date: 2017-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler