panteras_api 0.0.24 → 0.0.25

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: eeb5ebc31839e45b1d91d08a03a821644a6603da
4
- data.tar.gz: 2e5adbea11f05e82af189b12b46598e58b6647fd
3
+ metadata.gz: ea8ca118bcd94f2214e8b26b808ff340c0a2256f
4
+ data.tar.gz: 19410c55001484b73f5febcafcfc73a56a6030da
5
5
  SHA512:
6
- metadata.gz: 27e0c7f2826ee4eec93a4a082df45bb7d81d8b4a2f74303a98896c845a0a64173a4d568cfdf12a491b54b4a3141d5de022cd963498be6fa0e61e2a8459203722
7
- data.tar.gz: 223f6a8d7a341ee53364e6cd531ffa5086a18998d155670a3bc1b76c29210f7bdfa338ab94edbf8ad2c946e96a48a91226b4b70d5b654790c107425f9958f582
6
+ metadata.gz: 774f39767226b84eebb8fdafa197cfe08e1922f2a5da3f9645e38e029a4f19cf44dde229b58d77cd9c66974220a75277929ef0b06699d7451fe7d11f356b6c78
7
+ data.tar.gz: cb947d62cf63f2b3c5ede496b64900c441004151db1e9f7637b197f12cddca9b773655d191bf405ad995485611805e7a6d672d30aff8806c82eb6204985e506d
@@ -72,9 +72,23 @@ puts "* My hostname: #{my_fqdn}" if config[:debug]
72
72
 
73
73
  timeout_in_seconds = config[:timeout]
74
74
 
75
+ marathon_temp = MarathonEndpoint.new(config[:mesos_master_hostname], 8080, config[:marathon_username], config[:marathon_password])
76
+ @marathon = MarathonEndpoint.new(marathon_temp.leader, 8080, config[:marathon_username], config[:marathon_password])
77
+
78
+ ### Skip when deploymetns - in multiple places to aviod race conditions
79
+ def exit_on_deployment
80
+ if ! @marathon.deployments.empty?
81
+ puts "Deployment in progess"
82
+ exit 0
83
+ end
84
+ end
85
+
86
+ exit_on_deployment
87
+
75
88
  begin
76
89
  Timeout::timeout(timeout_in_seconds) do
77
90
 
91
+
78
92
  ### MESOS
79
93
  puts "#" * 75 if config[:debug]
80
94
  puts "* Mesos tasks ids running this cluster (all slaves):" if config[:debug]
@@ -94,18 +108,17 @@ Timeout::timeout(timeout_in_seconds) do
94
108
  #puts mesos.task_ids('chronos-config').sort
95
109
  end
96
110
 
111
+ exit_on_deployment
112
+
97
113
  ### MARATHON
98
114
  puts "#" * 75 if config[:debug]
99
115
  puts "* Marathon tasks on #{my_fqdn}:" if config[:debug]
100
- marathon = MarathonEndpoint.new(mesos.master_hostname, 8080, config[:marathon_username], config[:marathon_password])
101
- if ! marathon.deployments.empty?
102
- puts "Deployment in progess"
103
- exit 0
104
- end
105
- marathon_tasks = marathon.my_task_ids(my_fqdn, 'marathon')
116
+ marathon_tasks = @marathon.my_task_ids(my_fqdn, 'marathon')
106
117
  puts marathon_tasks.sort if config[:debug]
107
118
  good_news << "#{marathon_tasks.size} marathon tasks running."
108
119
 
120
+ exit_on_deployment
121
+
109
122
  ## MESOS LOCAL
110
123
  puts "#" * 75 if config[:debug]
111
124
  puts "* Mesos tasks ids for tasks running on #{my_fqdn}:" if config[:debug]
@@ -114,6 +127,8 @@ Timeout::timeout(timeout_in_seconds) do
114
127
  puts mesos_tasks.sort if config[:debug]
115
128
  good_news << "#{mesos_tasks.size} mesos tasks running." if ! mesos_tasks.empty?
116
129
 
130
+ exit_on_deployment
131
+
117
132
  ### CHRONOS
118
133
  puts "#" * 75 if config[:debug]
119
134
  puts "* Chronos tasks on #{my_fqdn}:" if config[:debug]
@@ -152,6 +167,7 @@ Timeout::timeout(timeout_in_seconds) do
152
167
  puts consul_services.sort if config[:debug]
153
168
  good_news << "#{consul_services.size} consul services running."
154
169
 
170
+ exit_on_deployment
155
171
 
156
172
  ### set these environment variables here or in shell for testing a remote docker (ie, boot2docker)
157
173
  #ENV['DOCKER_HOST']='tcp://192.168.59.103:2376'
@@ -212,6 +228,8 @@ rescue Timeout::Error
212
228
  good_news << "Time out - no response in reasonable time"
213
229
  end
214
230
 
231
+ exit_on_deployment
232
+
215
233
  if ! bad_news.empty?
216
234
  puts "problems on #{my_fqdn}: #{bad_news.join(' ')}"
217
235
  exit config[:error_exit_code]
@@ -18,13 +18,18 @@ class MarathonEndpoint
18
18
  to_j(get_response_with_redirect(@host, '/v2/apps/', @port, @user, @passwd))[:apps]
19
19
  end
20
20
 
21
+ def leader
22
+ to_j(get_response_with_redirect(@host, '/v2/leader', @port, @user, @passwd))[:leader].split(':').first
23
+ end
24
+
21
25
  def deployments
22
26
  to_j(get_response_with_redirect(@host, '/v2/deployments', @port, @user, @passwd))
23
27
  end
24
28
 
25
29
  def app_names
26
- raise StandardError, "Empty response from marathon", caller if all_apps.nil?
27
- all_apps.collect { |a| a[:id][1..-1] }
30
+ apps = all_apps
31
+ raise StandardError, "Empty response from marathon", caller if apps.nil?
32
+ apps.collect { |a| a[:id][1..-1] }
28
33
  end
29
34
 
30
35
  def tasks_ids(app_name)
@@ -1,3 +1,3 @@
1
1
  module PanterasApi
2
- VERSION = "0.0.24"
2
+ VERSION = "0.0.25"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: panteras_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Colby