mtncd 0.1.1 → 0.2.0

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.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ stackato-report
data/Gemfile.lock CHANGED
@@ -1,13 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mtncd (0.0.8)
4
+ mtncd (0.1.1)
5
5
  awesome_print (= 1.2.0)
6
6
  gli (= 2.12.2)
7
+ highline (= 1.6.21)
7
8
  msgpack (= 0.5.9)
8
9
  redis (= 3.1.0)
9
10
  resque (= 1.25.2)
10
11
  serfx (= 0.0.8)
12
+ stackadmin (= 1.0.0)
11
13
 
12
14
  GEM
13
15
  remote: https://rubygems.org/
@@ -31,12 +33,16 @@ GEM
31
33
  gherkin (2.12.2)
32
34
  multi_json (~> 1.3)
33
35
  gli (2.12.2)
36
+ highline (1.6.21)
34
37
  json (1.8.1)
35
38
  mixlib-log (1.6.0)
36
39
  mono_logger (1.1.0)
37
40
  msgpack (0.5.9)
38
41
  multi_json (1.10.1)
39
42
  multi_test (0.1.1)
43
+ net-scp (1.2.1)
44
+ net-ssh (>= 2.6.5)
45
+ net-ssh (2.9.2)
40
46
  rack (1.6.0)
41
47
  rack-protection (1.5.3)
42
48
  rack
@@ -63,6 +69,10 @@ GEM
63
69
  rack (~> 1.4)
64
70
  rack-protection (~> 1.4)
65
71
  tilt (~> 1.3, >= 1.3.4)
72
+ stackadmin (1.0.0)
73
+ json
74
+ net-scp
75
+ net-ssh
66
76
  tilt (1.4.1)
67
77
  vegas (0.1.11)
68
78
  rack (>= 1.0.0)
data/bin/mtncd CHANGED
@@ -12,6 +12,7 @@ require 'redis'
12
12
  require 'open3'
13
13
  require 'resque'
14
14
  require 'highline/import'
15
+ require 'stackadmin'
15
16
 
16
17
  include GLI::App
17
18
 
@@ -37,7 +38,7 @@ command :deploy do |deploy|
37
38
 
38
39
  start.desc 'local or global cluster command'
39
40
  start.default_value 'global'
40
- start.flag :cluster, :must_match => {
41
+ start.flag :cluster, :must_match => {
41
42
  'global' => 'global',
42
43
  'local' => 'local'
43
44
  }
@@ -53,8 +54,8 @@ command :deploy do |deploy|
53
54
  start.switch :single
54
55
 
55
56
  start.action do |global_options,options,args|
56
- event_options_hash = {
57
- 'id' => "#{options[:id]}",
57
+ event_options_hash = {
58
+ 'id' => "#{options[:id]}",
58
59
  'single' => options[:single],
59
60
  }
60
61
  event_options_hash['exclusion'] = options[:exclude].nil? ? $config['default_exclude'] : options[:exclude]
@@ -97,14 +98,14 @@ command :deploy do |deploy|
97
98
 
98
99
  stop.desc 'local or global cluster command'
99
100
  stop.default_value 'global'
100
- stop.flag :cluster, :must_match => {
101
+ stop.flag :cluster, :must_match => {
101
102
  'global' => 'global',
102
103
  'local' => 'local'
103
104
  }
104
105
 
105
106
  stop.action do |global_options,options,args|
106
107
 
107
- event_options_hash = {
108
+ event_options_hash = {
108
109
  'id' => "#{options[:id]}"
109
110
  }
110
111
 
@@ -133,7 +134,7 @@ command :deploy do |deploy|
133
134
  success.flag :id, :required => true
134
135
 
135
136
  success.action do |global_options,options,args|
136
- event_options_hash = {
137
+ event_options_hash = {
137
138
  'id' => "#{options[:id]}",
138
139
  'env' => $config['ship']['environment'],
139
140
  'shipcodes' => [ $config['ship']['shipcode'] ]
@@ -170,19 +171,19 @@ command :deploy do |deploy|
170
171
  raise "Error running 'deploy success' : #{e.message}"
171
172
  end
172
173
  end
173
- end
174
+ end
174
175
  end
175
176
 
176
177
  desc 'cluster status'
177
178
  command :status do |status|
178
179
  status.desc 'local or global cluster'
179
180
  status.default_value 'global'
180
- status.flag :cluster, :must_match => {
181
+ status.flag :cluster, :must_match => {
181
182
  'global' => 'global',
182
183
  'local' => 'local'
183
184
  }
184
185
 
185
- status.action do |global_options,options,args|
186
+ status.action do |global_options,options,args|
186
187
 
187
188
  serf_options_hash = {
188
189
  'ip' => $config['serf'][options[:cluster]]['rpc_ip'],
@@ -221,7 +222,7 @@ command :system do |system|
221
222
  Resque.redis = "#{$config['resque']['redis_ip']}:#{$config['resque']['redis_port']}/#{$config['resque']['redis_db']}"
222
223
 
223
224
  # clean up any workers that didn't exit gracefuly.
224
- Resque.workers.each { |worker|
225
+ Resque.workers.each { |worker|
225
226
  worker.prune_dead_workers
226
227
  }
227
228
 
@@ -233,7 +234,7 @@ command :system do |system|
233
234
  success = false
234
235
  puts "Resque - failed to get worker count - [#{result}]"
235
236
  end
236
-
237
+
237
238
  # check serf
238
239
  if $config['role'] == 'ship' || $config['role'] == 'sled'
239
240
  begin
@@ -275,7 +276,7 @@ command :ping do |ping|
275
276
 
276
277
  ping.desc 'local or global cluster command'
277
278
  ping.default_value 'global'
278
- ping.flag :cluster, :must_match => {
279
+ ping.flag :cluster, :must_match => {
279
280
  'global' => 'global',
280
281
  'local' => 'local'
281
282
  }
@@ -284,7 +285,7 @@ command :ping do |ping|
284
285
  ping.default_value 60
285
286
  ping.flag :timeout
286
287
 
287
- ping.action do |global_options,options,args|
288
+ ping.action do |global_options,options,args|
288
289
  begin
289
290
  puts "This might take up to #{options[:timeout]} seconds" unless options[:json]
290
291
 
@@ -302,7 +303,7 @@ command :ping do |ping|
302
303
  end
303
304
  command_string += " -rpc-addr=#{$config['serf'][options[:cluster]]['rpc_ip']}:#{$config['serf'][options[:cluster]]['rpc_port']}"
304
305
  command_string += " -rpc-auth=#{$config['serf'][options[:cluster]]['rpc_auth']}" unless $config['serf'][options[:cluster]]['rpc_auth'].nil?
305
-
306
+
306
307
  start_time = Time.now.to_i
307
308
  command_string += " ping #{start_time}"
308
309
 
@@ -322,7 +323,7 @@ command :ping do |ping|
322
323
  end
323
324
 
324
325
  if options[:json]
325
- puts JSON.pretty_generate(serf_output)
326
+ puts JSON.pretty_generate(serf_output)
326
327
  else
327
328
  puts "\033[31mFailure: #{serf_output['Error']}\033[0m" unless serf_output['Error'].nil?
328
329
 
@@ -367,7 +368,7 @@ command :resque do |resque|
367
368
  puts "Worker #{worker.to_s} processing job #{worker.job}"
368
369
  }
369
370
  end
370
- end
371
+ end
371
372
 
372
373
  resque.desc 'resque errors'
373
374
  resque.command :errors do |errors|
@@ -380,13 +381,13 @@ command :resque do |resque|
380
381
  puts '--------------------'
381
382
  }
382
383
  end
383
- end
384
+ end
384
385
 
385
386
  resque.desc 'flush redis (destructive)'
386
387
  resque.command :flush do |flush|
387
388
  flush.action do |global_options,options,args|
388
389
  redis = Redis.new(:host => $config['resque']['redis_ip'], :port => $config['resque']['redis_port'], :db => $config['resque']['redis_db'])
389
-
390
+
390
391
  res = ask("Enter 'flush' to continue or anything else to cancel.")
391
392
  if res == 'flush'
392
393
  redis.flushall
@@ -397,12 +398,49 @@ command :resque do |resque|
397
398
  end
398
399
  end
399
400
 
401
+ desc 'Stackato administration'
402
+ skips_pre
403
+ skips_post
404
+ command :stk do |stk|
405
+ stk.arg 'TARGET_STACKATO'
406
+
407
+ stk.desc 'Get a report'
408
+ stk.command :report do |report|
409
+ report.desc 'destination for stackato-report'
410
+ report.default_value '.'
411
+ report.flag [:d, :destination]
412
+
413
+ report.desc 'download report as a tarball'
414
+ report.default_value false
415
+ report.switch [:t, :tgz, :tarball]
416
+
417
+ report.desc 'get a full cluster report'
418
+ report.default_value false
419
+ report.switch [:c, :cluster]
420
+
421
+ report.action do |global_options, options, args|
422
+ report_opts = []
423
+ [:tarball, :cluster].each do
424
+ |opt| report_opts << opt if options[opt]
425
+ end
426
+
427
+ puts "Connecting to: #{args[0]}..."
428
+ target = Stackadmin.new args[0]
429
+
430
+ puts "Generating report..."
431
+ output = target.report(*report_opts, destination: options[:destination])
432
+
433
+ puts "Done! Report at: #{output}"
434
+ end
435
+ end
436
+ end
437
+
400
438
 
401
439
  pre do |global,command,options,args|
402
440
 
403
- config_path = File.exists?(File.join('/', 'opt', 'mtn_cicd', '.cicdconfig')) ?
441
+ config_path = File.exists?(File.join('/', 'opt', 'mtn_cicd', '.cicdconfig')) ?
404
442
  File.join('/', 'opt', 'mtn_cicd', '.cicdconfig') : File.join(Dir.home, '.cicdconfig')
405
-
443
+
406
444
  $config = JSON.parse(File.read(config_path))
407
445
 
408
446
  if $config['role'] == 'sled' && options[:cluster] == 'global'
data/lib/mtncd/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mtncd
2
- VERSION = '0.1.1'
2
+ VERSION = '0.2.0'
3
3
  end
data/mtncd.gemspec CHANGED
@@ -22,6 +22,7 @@ spec = Gem::Specification.new do |s|
22
22
  s.add_dependency('awesome_print', '1.2.0')
23
23
  s.add_dependency('redis', '3.1.0')
24
24
  s.add_dependency('highline', '1.6.21')
25
+ s.add_dependency('stackadmin', '1.0.0')
25
26
  s.add_development_dependency('rake')
26
27
  s.add_development_dependency('rdoc')
27
28
  s.add_development_dependency('aruba')
metadata CHANGED
@@ -1,18 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtncd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - MTN Satellite Communications
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
12
+ date: 2015-04-07 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: resque
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - '='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - '='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: serfx
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - '='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - '='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: msgpack
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - '='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - '='
53
60
  - !ruby/object:Gem::Version
@@ -55,6 +62,7 @@ dependencies:
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: awesome_print
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
67
  - - '='
60
68
  - !ruby/object:Gem::Version
@@ -62,6 +70,7 @@ dependencies:
62
70
  type: :runtime
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
75
  - - '='
67
76
  - !ruby/object:Gem::Version
@@ -69,6 +78,7 @@ dependencies:
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: redis
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
83
  - - '='
74
84
  - !ruby/object:Gem::Version
@@ -76,6 +86,7 @@ dependencies:
76
86
  type: :runtime
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
91
  - - '='
81
92
  - !ruby/object:Gem::Version
@@ -83,6 +94,7 @@ dependencies:
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: highline
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
99
  - - '='
88
100
  - !ruby/object:Gem::Version
@@ -90,13 +102,31 @@ dependencies:
90
102
  type: :runtime
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
107
  - - '='
95
108
  - !ruby/object:Gem::Version
96
109
  version: 1.6.21
110
+ - !ruby/object:Gem::Dependency
111
+ name: stackadmin
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.0.0
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - '='
124
+ - !ruby/object:Gem::Version
125
+ version: 1.0.0
97
126
  - !ruby/object:Gem::Dependency
98
127
  name: rake
99
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
100
130
  requirements:
101
131
  - - ! '>='
102
132
  - !ruby/object:Gem::Version
@@ -104,6 +134,7 @@ dependencies:
104
134
  type: :development
105
135
  prerelease: false
106
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
107
138
  requirements:
108
139
  - - ! '>='
109
140
  - !ruby/object:Gem::Version
@@ -111,6 +142,7 @@ dependencies:
111
142
  - !ruby/object:Gem::Dependency
112
143
  name: rdoc
113
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
114
146
  requirements:
115
147
  - - ! '>='
116
148
  - !ruby/object:Gem::Version
@@ -118,6 +150,7 @@ dependencies:
118
150
  type: :development
119
151
  prerelease: false
120
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
121
154
  requirements:
122
155
  - - ! '>='
123
156
  - !ruby/object:Gem::Version
@@ -125,6 +158,7 @@ dependencies:
125
158
  - !ruby/object:Gem::Dependency
126
159
  name: aruba
127
160
  requirement: !ruby/object:Gem::Requirement
161
+ none: false
128
162
  requirements:
129
163
  - - ! '>='
130
164
  - !ruby/object:Gem::Version
@@ -132,6 +166,7 @@ dependencies:
132
166
  type: :development
133
167
  prerelease: false
134
168
  version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
135
170
  requirements:
136
171
  - - ! '>='
137
172
  - !ruby/object:Gem::Version
@@ -139,6 +174,7 @@ dependencies:
139
174
  - !ruby/object:Gem::Dependency
140
175
  name: gli
141
176
  requirement: !ruby/object:Gem::Requirement
177
+ none: false
142
178
  requirements:
143
179
  - - '='
144
180
  - !ruby/object:Gem::Version
@@ -146,6 +182,7 @@ dependencies:
146
182
  type: :runtime
147
183
  prerelease: false
148
184
  version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
149
186
  requirements:
150
187
  - - '='
151
188
  - !ruby/object:Gem::Version
@@ -159,6 +196,7 @@ extra_rdoc_files:
159
196
  - README.rdoc
160
197
  - mtncd.rdoc
161
198
  files:
199
+ - .gitignore
162
200
  - Gemfile
163
201
  - Gemfile.lock
164
202
  - README.md
@@ -176,7 +214,6 @@ files:
176
214
  - test/test_helper.rb
177
215
  homepage: https://github.com/mtnsat
178
216
  licenses: []
179
- metadata: {}
180
217
  post_install_message:
181
218
  rdoc_options:
182
219
  - --title
@@ -188,19 +225,21 @@ require_paths:
188
225
  - lib
189
226
  - lib
190
227
  required_ruby_version: !ruby/object:Gem::Requirement
228
+ none: false
191
229
  requirements:
192
230
  - - ! '>='
193
231
  - !ruby/object:Gem::Version
194
232
  version: '0'
195
233
  required_rubygems_version: !ruby/object:Gem::Requirement
234
+ none: false
196
235
  requirements:
197
236
  - - ! '>='
198
237
  - !ruby/object:Gem::Version
199
238
  version: '0'
200
239
  requirements: []
201
240
  rubyforge_project:
202
- rubygems_version: 2.2.2
241
+ rubygems_version: 1.8.23.2
203
242
  signing_key:
204
- specification_version: 4
243
+ specification_version: 3
205
244
  summary: A helper tool for MTN CICD pipeline
206
245
  test_files: []
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NGExNjBkNGVjMWM1ZjlkM2M5YjhlNjliMDY2ZGY1YjI0ZGY2ZWNiNg==
5
- data.tar.gz: !binary |-
6
- OTYwYjMxMzIxZTJmOWZkNjg5NmM2OWFiNjA1NGVjYzZmNDVlNDg2ZQ==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- MDI5ZmRmY2Q4NzVkMjQ0OWY3OThjZjM2MTU3MTAwOGI5ZGRlNWJjNzYxYjc5
10
- ZmU5M2YyNDgxZDUxODVhNGU4ZThkNjg3YWM3NjFhYWI2YThmOTY5YTMzMjFl
11
- NmJhMmYzOWJkZjA2YTdhNDQ2NWUzNjE3ODhjNDUyZWQwZWRkMzI=
12
- data.tar.gz: !binary |-
13
- NTg4OWM3MjAyMjc2NTY0MTcyOWYwNWMyMjllOTg4ZjdhN2RiMWMwOWY4M2Iw
14
- MzRiNGZmNzI0NTYwMjg0NzhkMWU0OGRhY2JlNmI3OWRmZjcwMDFhNWViYTY1
15
- NjZjYTAzM2UyYWEzZTNhNWQ3YTY4OWZmODUwZjVjNTFjMzNkNDg=