mtncd 0.0.10 → 0.0.11

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.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/bin/mtncd +50 -7
  3. data/lib/mtncd/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTdlM2MyNjlmODkxYjdlZDk4YjZmNzc5NWIxOWVkZGFhMTA3Njg2Nw==
4
+ N2FkNDcxZGZlOWJiNjAxZjA4ZjgxM2YyZmQyOTYzYzYyOGI0Yjg3MQ==
5
5
  data.tar.gz: !binary |-
6
- M2FlZWM0OGJjY2Y3MWJlYzA2ODAyNWFhZmZjNzU5OGVlNzg4OGI3Yg==
6
+ N2QxMzU3NTFjYmZjMDc0ODE1MGI2YTQwNTBkNGE0MjQ2NmIwOGM0Yw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTlkNGQ1ZmEyZDI1ZDgzMWM5NTllMTA4Y2E0MWY0YmJhYTgxOTAzMjIwYTE3
10
- ZGVmMzlmOTY4M2Q0MGQyZmU1OWMwOTQwNGIyMzMyYjI3NzZiYzk5YWZiNWFh
11
- YWJjOTcxNmZhMDk3YWEyOTNhMTE2NDlkY2Q4OTVhMDU1ODBiNmE=
9
+ NGRjZDlmMWUyNDI4YjlmMDQ2MzA2NzE1MmRkYWZjZDU2Njc3Mzk5MTY4YTVk
10
+ NDlmNTRmMDViZWQzOTEzNTdjYWM3MTFlYjAyZGNjNGE5NzI0NzAzNGI2NTQ5
11
+ NTZlMDA5OWY2MWI5MTNlNTg3M2E0YjE2ZTA3MGM5YjQxYjc0ZTQ=
12
12
  data.tar.gz: !binary |-
13
- ZjM4ZTBkZWIzMzlhOTFlODJlYjg1NGZlNTJlYmU5OWZlMmNmNWY4NzAyNGJh
14
- NTY4MDdkYmYwYzcwYTIxY2M1MDI5Y2FjZjMyODM4NjZmOTA1ODgxYTVmZDU1
15
- MzU5NzI1NTNjMmVmNmVkNDVhNzQ0YWQ4NTQxMmU3ZmYyMDdmZWY=
13
+ Mjk3ZTIzY2FjZDZmMGJjYjNkZGIwOGM4Mzk0YzNiYzg2Mzg5NjliYjI1Zjlj
14
+ ZjRlNjUwYzI0MTY4YzYxMmQ1MDZhZGQ2ODgzNzk3ODdiZWE5MjkzYzNmMGJl
15
+ MTg2NTliY2VhZTVkNDdkMGEyZjYyNTRkZTMwY2UyN2EzYTcxMWI=
data/bin/mtncd CHANGED
@@ -22,7 +22,7 @@ version Mtncd::VERSION
22
22
  subcommand_option_handling :normal
23
23
  arguments :strict
24
24
 
25
- desc 'start or stop a deployment'
25
+ desc 'deployment operations'
26
26
  command :deploy do |deploy|
27
27
 
28
28
  deploy.desc "starts a deployment"
@@ -126,13 +126,51 @@ command :deploy do |deploy|
126
126
  end
127
127
  end
128
128
 
129
- deploy.desc "checks the status of a deployment"
130
- deploy.command :status do |status|
131
- status.action do |global_options,options,args|
132
- puts "not yet implemented"
129
+ deploy.desc "forces a deployment success"
130
+ deploy.command :success do |success|
131
+
132
+ success.desc 'deployment id'
133
+ success.flag :id, :required => true
134
+
135
+ success.action do |global_options,options,args|
136
+ event_options_hash = {
137
+ 'id' => "#{options[:id]}",
138
+ 'env' => $config['ship']['environment'],
139
+ 'shipcodes' => [ $config['ship']['shipcode'] ]
140
+ }
141
+
142
+ cluster = nil
143
+ event = nil
144
+ if $config['role'] == 'sled'
145
+ event_options_hash['sled'] = $config['ship']['sled']
146
+ cluster = 'local'
147
+ event = 'deploy_sleds_success'
148
+ else
149
+ cluster = 'global'
150
+ event = 'deploy_success'
151
+ end
152
+
153
+ serf_options_hash = {
154
+ 'ip' => $config['serf'][cluster]['rpc_ip'],
155
+ 'port' => $config['serf'][cluster]['rpc_port'],
156
+ 'auth' => $config['serf'][cluster]['rpc_auth'],
157
+ 'event' => event
158
+ }
159
+
160
+ begin
161
+ Serfx.connect(host: serf_options_hash['ip'], port: serf_options_hash['port'], authkey: serf_options_hash['auth']) do |conn|
162
+ resp = conn.event(serf_options_hash['event'], event_options_hash.to_msgpack, false)
163
+ puts "Sent a #{cluster} success for id #{options[:id]}"
164
+
165
+ if File.exist?(File.join($config['ship']['deployment_data'], "#{options[:id]}.deploy"))
166
+ File.delete(File.join($config['ship']['deployment_data'], "#{options[:id]}.deploy"))
167
+ end
168
+ end
169
+ rescue Serfx::RPCError => e
170
+ raise "Error running 'deploy success' : #{e.message}"
171
+ end
133
172
  end
134
- end
135
-
173
+ end
136
174
  end
137
175
 
138
176
  desc 'cluster status'
@@ -373,6 +411,11 @@ pre do |global,command,options,args|
373
411
  options[:cluster] = 'global'
374
412
  end
375
413
 
414
+ if $config['role'] == 'single' && options[:cluster] == 'local'
415
+ puts 'local commands are not available on single nodes. forcing \'--cluster=global\''
416
+ options[:cluster] = 'global'
417
+ end
418
+
376
419
  true
377
420
  end
378
421
 
data/lib/mtncd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mtncd
2
- VERSION = '0.0.10'
2
+ VERSION = '0.0.11'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtncd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - MTN Satellite Communications
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-05 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: resque