panteras_api 0.0.13 → 0.0.14
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.
- checksums.yaml +4 -4
- data/bin/mesos_consul_consistency_check +117 -97
- data/lib/panteras_api/docker_host.rb +18 -43
- data/lib/panteras_api/mesos_cluster.rb +20 -20
- data/lib/panteras_api/version.rb +1 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 331f68b3b84e5410dacd8b253ac760907e3fb46a
|
4
|
+
data.tar.gz: 4fc2fbd4214155a44ecae951ce212268f33e814b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1151d9f8ad7d839ddad03bd8120d53b1da8ba087743e2b094824f61ef07793d42b0b5aa70cc57aa242db7d087f3a519a42e69f64de6797e31d29a61dacb62f5d
|
7
|
+
data.tar.gz: 4ccde6d0c4aef235e01c96c5e6f9762e456bc5f6e8e9b148e450dabe2d39b2765de3923d08c557aca786c34837d3c11ae1c82d925dffd1cf97d0d2d7a91e3d48
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'optparse'
|
4
4
|
require 'panteras_api'
|
5
5
|
require 'json'
|
6
|
+
require 'timeout'
|
7
|
+
|
6
8
|
|
7
9
|
config_default = {
|
8
10
|
:mesos_master_hostname => 'localhost',
|
@@ -18,23 +20,23 @@ good_news = []
|
|
18
20
|
|
19
21
|
OptionParser.new("Usage: #{$0} [options]") do |opts|
|
20
22
|
opts.release = PanterasApi::VERSION
|
21
|
-
|
23
|
+
|
22
24
|
opts.on("-m", "--mesos-master-hostname MESOS_MASTER_HOSTNAME", "Default: #{config_default[:mesos_master_hostname]}") do |m|
|
23
25
|
options[:mesos_master_hostname] = m
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
opts.on("-p", "--mesos-master-port MESOS_MASTER_PORT", "Default: #{config_default[:mesos_master_port]}") do |p|
|
27
29
|
options[:mesos_master_port] = p
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
opts.on("-d", "--debug", "Default: #{config_default[:debug]}") do |d|
|
31
33
|
options[:debug] = d
|
32
34
|
end
|
33
|
-
|
35
|
+
|
34
36
|
opts.on("-c", "--critical", "Exit with Nagios CRITICAL (code 2). Default: WARNING (#{config_default[:error_exit_code]})") do |c|
|
35
37
|
options[:error_exit_code] = 2
|
36
38
|
end
|
37
|
-
|
39
|
+
|
38
40
|
opts.on("-f", "--fqdn FULLY_QUALIFIED_HOSTNAME", "Default: autodiscovery via gethostbyname") do |f|
|
39
41
|
options[:fqdn] = f
|
40
42
|
end
|
@@ -46,134 +48,152 @@ OptionParser.new("Usage: #{$0} [options]") do |opts|
|
|
46
48
|
opts.on("-P", "--passwd MARATHON_PASSWORD", "default: empty") do |passwd|
|
47
49
|
options[:marathon_password] = passwd
|
48
50
|
end
|
49
|
-
|
50
|
-
|
51
|
+
|
52
|
+
|
51
53
|
end.parse!
|
52
54
|
|
53
55
|
config_default[:fqdn] = Utils.fully_qualified_hostname if options[:fqdn].nil?
|
54
56
|
config = config_default.merge!(options)
|
55
57
|
|
56
|
-
### MESOS
|
57
|
-
|
58
58
|
my_fqdn = config[:fqdn]
|
59
59
|
|
60
60
|
puts "#" * 75 if config[:debug]
|
61
61
|
puts "* My hostname: #{my_fqdn}" if config[:debug]
|
62
62
|
|
63
|
-
|
64
|
-
puts "* Connecting to Mesos host: #{config[:mesos_master_hostname]}:#{config[:mesos_master_port]}" if config[:debug]
|
65
|
-
mesos = MesosCluster.new(config[:mesos_master_hostname], config[:mesos_master_port])
|
66
|
-
rescue SocketError, Errno::ECONNREFUSED => e
|
67
|
-
abort("Problem connecting to mesos host #{config[:mesos_master_hostname]}:#{config[:mesos_master_port]}: #{e.message}")
|
68
|
-
end
|
69
|
-
|
70
|
-
abort("No running mesos tasks seen on mesos master #{config[:mesos_master_hostname]}:#{config[:mesos_master_port]}") if mesos.tasks('marathon').nil?
|
71
|
-
|
72
|
-
puts "#" * 75 if config[:debug]
|
73
|
-
puts "* Mesos tasks ids running this cluster (all slaves):" if config[:debug]
|
74
|
-
puts mesos.tasks if config[:debug]
|
75
|
-
|
76
|
-
|
77
|
-
puts "#" * 75 if config[:debug]
|
78
|
-
puts "* Mesos tasks ids for tasks running on #{my_fqdn}:" if config[:debug]
|
79
|
-
mesos_tasks = mesos.my_tasks_ids(my_fqdn, 'marathon').flatten
|
80
|
-
mesos_tasks = mesos_tasks + mesos.my_tasks_ids(my_fqdn, 'chronos-2.4.0').flatten
|
81
|
-
|
82
|
-
puts mesos_tasks if config[:debug]
|
83
|
-
|
84
|
-
good_news << "#{mesos_tasks.size} mesos tasks running." if ! mesos_tasks.empty?
|
85
|
-
|
86
|
-
|
87
|
-
### MARATHON
|
88
|
-
marathon = MarathonEndpoint.new(mesos.master_hostname, 8080, config[:marathon_username], config[:marathon_password])
|
63
|
+
timeout_in_seconds = 10
|
89
64
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
65
|
+
begin
|
66
|
+
Timeout::timeout(timeout_in_seconds) do
|
67
|
+
|
68
|
+
### MESOS
|
69
|
+
puts "#" * 75 if config[:debug]
|
70
|
+
puts "* Mesos tasks ids running this cluster (all slaves):" if config[:debug]
|
71
|
+
begin
|
72
|
+
puts "* Connecting to Mesos host: #{config[:mesos_master_hostname]}:#{config[:mesos_master_port]}" if config[:debug]
|
73
|
+
mesos = MesosCluster.new(config[:mesos_master_hostname], config[:mesos_master_port])
|
74
|
+
rescue SocketError, Errno::ECONNREFUSED => e
|
75
|
+
abort("Problem connecting to mesos host #{config[:mesos_master_hostname]}:#{config[:mesos_master_port]}: #{e.message}")
|
76
|
+
end
|
77
|
+
abort("No running mesos tasks seen on mesos master #{config[:mesos_master_hostname]}:#{config[:mesos_master_port]}") if mesos.tasks('marathon').nil?
|
78
|
+
if config[:debug]
|
79
|
+
marathon_numer = mesos.task_ids('marathon').count if not mesos.task_ids('marathon').nil?
|
80
|
+
chronos_number = mesos.task_ids('chronos-2.4.0').count if not mesos.task_ids('chronos-2.4.0').nil?
|
81
|
+
puts "Number of marathon tasks globally: #{marathon_numer}"
|
82
|
+
puts "Number of chronos tasks globally: #{chronos_number}"
|
83
|
+
#puts mesos.task_ids('marathon').sort
|
84
|
+
#puts mesos.task_ids('chronos-2.4.0').sort
|
85
|
+
end
|
94
86
|
|
95
|
-
good_news << "#{marathon_tasks.size} marathon tasks running."
|
96
87
|
|
88
|
+
## MESOS LOCAL
|
89
|
+
puts "#" * 75 if config[:debug]
|
90
|
+
puts "* Mesos tasks ids for tasks running on #{my_fqdn}:" if config[:debug]
|
91
|
+
mesos_tasks = mesos.my_tasks_ids(my_fqdn, 'marathon').flatten
|
92
|
+
mesos_tasks = mesos_tasks + mesos.my_tasks_ids(my_fqdn, 'chronos-2.4.0').flatten
|
93
|
+
puts mesos_tasks.sort if config[:debug]
|
94
|
+
good_news << "#{mesos_tasks.size} mesos tasks running." if ! mesos_tasks.empty?
|
97
95
|
|
98
|
-
### CHRONOS
|
99
|
-
chronos = ChronosEndpoint.new(mesos.master_hostname, 4400)
|
100
96
|
|
101
|
-
|
102
|
-
puts "*
|
103
|
-
|
104
|
-
|
97
|
+
### MARATHON
|
98
|
+
puts "#" * 75 if config[:debug]
|
99
|
+
puts "* Marathon tasks on #{my_fqdn}:" if config[:debug]
|
100
|
+
marathon = MarathonEndpoint.new(mesos.master_hostname, 8080, config[:marathon_username], config[:marathon_password])
|
101
|
+
marathon_tasks = marathon.my_task_ids(my_fqdn, 'marathon')
|
102
|
+
puts marathon_tasks.sort if config[:debug]
|
103
|
+
good_news << "#{marathon_tasks.size} marathon tasks running."
|
105
104
|
|
106
|
-
## compare mesos tasks (source of truth) with tasks seen in marathon
|
107
|
-
only_in_mesos = mesos_tasks - marathon_tasks
|
108
|
-
chronos_tasks.each {|chronos_task| only_in_mesos.delete_if {|mesos_task| mesos_task.match(chronos_task) }}
|
109
105
|
|
110
|
-
|
111
|
-
|
106
|
+
### CHRONOS
|
107
|
+
puts "#" * 75 if config[:debug]
|
108
|
+
puts "* Chronos tasks on #{my_fqdn}:" if config[:debug]
|
109
|
+
chronos = ChronosEndpoint.new(mesos.master_hostname, 4400)
|
110
|
+
chronos_tasks = chronos.my_task_ids(my_fqdn, 'chronos-2.4.0')
|
111
|
+
puts chronos_tasks.sort if config[:debug]
|
112
112
|
|
113
|
-
|
114
|
-
|
115
|
-
|
113
|
+
## compare mesos tasks (source of truth) with tasks seen in marathon
|
114
|
+
only_in_mesos = mesos_tasks - marathon_tasks
|
115
|
+
chronos_tasks.each {|chronos_task| only_in_mesos.delete_if {|mesos_task| mesos_task.match(chronos_task) }}
|
116
116
|
|
117
|
-
if ! only_in_marathon.empty?
|
118
|
-
bad_news << "marathon tasks not seen in mesos: #{only_in_marathon.join(',')}"
|
119
|
-
end
|
120
117
|
|
121
118
|
|
122
|
-
|
123
|
-
|
124
|
-
### TODO: test with paas-formatted service names
|
125
|
-
puts "#" * 75 if config[:debug]
|
126
|
-
puts "* Consul services for #{my_fqdn}:" if config[:debug]
|
127
|
-
consul_services = consul.my_service_ids.reject { |p| p =~ /panteras/ }.collect { |d| d }.compact.reject { |i| i.empty? }
|
128
|
-
puts consul.my_services.join("\n") if config[:debug]
|
119
|
+
## compare marathon tasks with tasks seen in marathon
|
120
|
+
only_in_marathon = marathon_tasks - mesos_tasks
|
129
121
|
|
130
|
-
|
122
|
+
if ! only_in_mesos.empty?
|
123
|
+
bad_news << "mesos tasks not seen in marathon: #{only_in_mesos.join(',')}"
|
124
|
+
end
|
131
125
|
|
126
|
+
if ! only_in_marathon.empty?
|
127
|
+
bad_news << "marathon tasks not seen in mesos: #{only_in_marathon.join(',')}"
|
128
|
+
end
|
132
129
|
|
133
|
-
### set these environment variables here or in shell for testing a remote docker (ie, boot2docker)
|
134
|
-
#ENV['DOCKER_HOST']='tcp://192.168.59.103:2376'
|
135
|
-
#ENV['DOCKER_CERT_PATH']='/Users/jcolby/.boot2docker/certs/boot2docker-vm'
|
136
|
-
#ENV['DOCKER_TLS_VERIFY']='1'
|
137
130
|
|
138
|
-
###
|
131
|
+
### CONSUL
|
132
|
+
puts "#" * 75 if config[:debug]
|
133
|
+
puts "* Consul registered mesos services for #{my_fqdn}:" if config[:debug]
|
134
|
+
consul = ConsulCluster.new(mesos.master_hostname)
|
135
|
+
consul_services = consul.my_service_ids.reject { |p| p =~ /panteras/ }.collect { |d| d }.compact.reject { |i| i.empty? }
|
136
|
+
#puts consul.my_services.join("\n") if config[:debug]
|
137
|
+
puts consul_services.sort if config[:debug]
|
138
|
+
good_news << "#{consul_services.size} consul services running."
|
139
|
+
|
140
|
+
|
141
|
+
### set these environment variables here or in shell for testing a remote docker (ie, boot2docker)
|
142
|
+
#ENV['DOCKER_HOST']='tcp://192.168.59.103:2376'
|
143
|
+
#ENV['DOCKER_CERT_PATH']='/Users/jcolby/.boot2docker/certs/boot2docker-vm'
|
144
|
+
#ENV['DOCKER_TLS_VERIFY']='1'
|
145
|
+
|
146
|
+
|
147
|
+
### DOCKER
|
148
|
+
puts "#" * 75 if config[:debug]
|
149
|
+
puts "* Docker"
|
150
|
+
puts "#" * 75 if config[:debug]
|
151
|
+
docker_inspect = DockerHost.inspect
|
152
|
+
docker_tasks = docker_inspect.collect { |d| d[:mesos_task_id] }.compact.reject { |i| i.empty? }
|
153
|
+
docker_mesos_ids = docker_inspect.collect { |d| d[:name] }.compact.reject { |i| i.empty? }
|
154
|
+
if config[:debug]
|
155
|
+
#puts docker_inspect
|
156
|
+
puts "* Docker tasks on #{my_fqdn}:"
|
157
|
+
puts docker_tasks.sort
|
158
|
+
puts "#" * 75
|
159
|
+
puts "* Docker containers with mesos ids on #{my_fqdn}:"
|
160
|
+
puts docker_mesos_ids.sort
|
161
|
+
end
|
139
162
|
|
140
|
-
|
141
|
-
|
142
|
-
|
163
|
+
mesos_not_docker = mesos_tasks - docker_tasks
|
164
|
+
if ! mesos_not_docker.empty?
|
165
|
+
bad_news << "mesos tasks not running in docker: #{mesos_not_docker.join(',')}"
|
166
|
+
end
|
143
167
|
|
144
|
-
|
145
|
-
|
146
|
-
|
168
|
+
docker_not_mesos = docker_tasks - mesos_tasks
|
169
|
+
if ! docker_not_mesos.empty?
|
170
|
+
bad_news << "docker tasks not seen in mesos: #{docker_not_mesos.join(',')}"
|
171
|
+
end
|
147
172
|
|
148
|
-
|
149
|
-
|
150
|
-
bad_news << "mesos tasks not running in docker: #{mesos_not_docker.join(',')}"
|
151
|
-
end
|
173
|
+
good_news << "#{docker_inspect.count { |d| d[:name] if d[:chronos_job] }} chronos task running."
|
174
|
+
good_news << "#{docker_tasks.size} docker tasks running"
|
152
175
|
|
153
|
-
|
154
|
-
if !
|
155
|
-
|
156
|
-
|
176
|
+
### Compare consul-registered tasks vs docker tasks
|
177
|
+
docker_mesos_ids_no_panteras = docker_inspect.reject { |p| p[:name] =~ /panteras/ }.collect { |d| d[:name] if ! d[:chronos_job] }.compact.reject { |i| i.empty? }
|
178
|
+
consul_not_docker = consul_services - docker_mesos_ids_no_panteras
|
179
|
+
docker_not_consul = docker_mesos_ids_no_panteras - consul_services
|
157
180
|
|
158
|
-
|
159
|
-
|
181
|
+
if ! consul_not_docker.empty?
|
182
|
+
bad_news << "consul tasks not seen in docker: #{consul_not_docker.join(',')}"
|
183
|
+
end
|
160
184
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
docker_not_consul = docker_mesos_ids_no_panteras - consul_services
|
185
|
+
if ! docker_not_consul.empty?
|
186
|
+
bad_news << "docker tasks not seen in consul: #{docker_not_consul.join(',')}"
|
187
|
+
end
|
165
188
|
|
166
|
-
if ! consul_not_docker.empty?
|
167
|
-
bad_news << "consul tasks not seen in docker: #{consul_not_docker.join(',')}"
|
168
189
|
end
|
169
|
-
|
170
|
-
|
171
|
-
bad_news << "docker tasks not seen in consul: #{docker_not_consul.join(',')}"
|
190
|
+
rescue Timeout::Error
|
191
|
+
good_news << "Time out - no response in reasonable time"
|
172
192
|
end
|
173
193
|
|
174
194
|
if ! bad_news.empty?
|
175
195
|
puts "problems on #{my_fqdn}: #{bad_news.join(' ')}"
|
176
|
-
exit config[:error_exit_code]
|
196
|
+
exit config[:error_exit_code]
|
177
197
|
end
|
178
198
|
|
179
199
|
puts good_news.join(' ')
|
@@ -184,7 +204,7 @@ __END__
|
|
184
204
|
CHECKS:
|
185
205
|
mesos vs marathon
|
186
206
|
mesos vs docker
|
187
|
-
docker vs consul
|
207
|
+
docker vs consul
|
188
208
|
|
189
209
|
consul (api):
|
190
210
|
Slave Host, mesos-name (ServiceID) "paasslave46-2:mesos-c71da994-a35b-4dde-9970-d175c04da735:8080"
|
@@ -2,76 +2,51 @@ require 'open3'
|
|
2
2
|
|
3
3
|
class DockerHost
|
4
4
|
extend HTTPUtils
|
5
|
-
|
5
|
+
|
6
6
|
def self.ps
|
7
|
-
self.command("docker ps")[:output]
|
8
|
-
end
|
9
|
-
|
10
|
-
def self.running_containers
|
11
7
|
output = self.command("docker ps")[:output]
|
12
8
|
raise MesosConsulCommandError, "Command 'docker ps' did not return an array of strings" if (output.class != Array || output.length == 0)
|
13
|
-
|
9
|
+
return output
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.running_containers
|
13
|
+
output = self.ps
|
14
14
|
result = output.map.with_index do |line, i|
|
15
|
-
next if i == 0
|
15
|
+
next if i == 0
|
16
16
|
container_id, image, *center, name = line.split
|
17
|
-
{ container_id: container_id, name: name, image: image }
|
17
|
+
{ container_id: container_id, name: name, image: image }
|
18
18
|
end
|
19
|
-
|
20
19
|
return result.compact
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
def self.inspect(*keys)
|
24
23
|
containers = self.running_containers
|
25
24
|
containers.map do |c|
|
26
25
|
inspect = self.command("docker inspect #{c[:container_id]}")[:output]
|
27
|
-
h = to_j(inspect.join).first
|
26
|
+
h = to_j(inspect.join).first
|
28
27
|
task_id = h[:Config][:Env].select { |env| env.upcase =~ /MESOS_TASK_ID=/ }.first
|
29
|
-
mesos_task_id = task_id.nil? ? '' : task_id.split(/=/)[1]
|
28
|
+
mesos_task_id = task_id.nil? ? '' : task_id.split(/=/)[1]
|
30
29
|
{ id: h[:Id], image: h[:Image], name: h[:Name][1..-1], mesos_task_id: mesos_task_id, chronos_job: h[:Config][:Env].join(',').include?('CHRONOS_JOB_NAME=') ? true : false }
|
31
30
|
end
|
32
31
|
end
|
33
|
-
|
32
|
+
|
34
33
|
def self.inspect_partial
|
35
34
|
self.inspect
|
36
35
|
end
|
37
|
-
|
36
|
+
|
38
37
|
private
|
39
|
-
|
38
|
+
|
40
39
|
class MesosConsulCommandError < StandardError ; end
|
41
|
-
|
40
|
+
|
42
41
|
def self.command(command)
|
43
42
|
output = []
|
44
43
|
error = []
|
45
44
|
begin
|
46
|
-
|
47
|
-
|
48
|
-
exit_status = wait_thr.value
|
49
|
-
|
50
|
-
unless exit_status.success?
|
51
|
-
$stderr.puts stderr.readlines
|
52
|
-
raise MesosConsulCommandError, "Command '#{command}' returned status #{exit_status.exitstatus}"
|
53
|
-
end
|
54
|
-
|
55
|
-
while line = stderr.gets
|
56
|
-
$stderr.puts line
|
57
|
-
if line.strip.length > 0
|
58
|
-
error << line.strip
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
while line = stdout.gets
|
63
|
-
if line.strip.length > 0
|
64
|
-
output << line.strip
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
|
45
|
+
stdout, stderr, status = Open3.capture3(command)
|
70
46
|
rescue Errno::ENOENT => e
|
71
47
|
raise MesosConsulCommandError, "Error while running command #{command}: #{e.message}"
|
72
48
|
end
|
73
|
-
|
74
|
-
return { :output => output, :error => error}
|
75
|
-
|
49
|
+
return { :output => stdout.split(/\n+/), :error => stderr.split(/\n+/)}
|
76
50
|
end
|
51
|
+
|
77
52
|
end
|
@@ -7,9 +7,9 @@ require 'pp'
|
|
7
7
|
class MesosCluster
|
8
8
|
include HTTPUtils
|
9
9
|
include Utils
|
10
|
-
|
10
|
+
|
11
11
|
attr_reader :state
|
12
|
-
|
12
|
+
|
13
13
|
def initialize(host, port=5050)
|
14
14
|
@protocol = "http:"
|
15
15
|
@host = host
|
@@ -26,29 +26,29 @@ class MesosCluster
|
|
26
26
|
if URI.parse(redirect_response).kind_of?(URI::HTTP)
|
27
27
|
if ! valid_url(redirect_response.to_s)
|
28
28
|
raise StandardError, "Response from #{@protocol}//#{@host}:#{@port}#{@master_info} is not a valid url: #{redirect_response.to_s}"
|
29
|
-
end
|
29
|
+
end
|
30
30
|
uri = construct_uri redirect_response.to_s
|
31
31
|
return to_j(get_response_with_redirect(uri.host, @state_info, uri.port))
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
end
|
35
|
-
|
35
|
+
|
36
36
|
def master_hostname
|
37
|
-
state[:hostname]
|
37
|
+
state[:hostname]
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
def master_id
|
41
41
|
state[:id]
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
def frameworks
|
45
45
|
state[:frameworks]
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def tasks_completed
|
49
|
-
state[:frameworks].collect { |f| f[:completed_tasks].collect { |t| t } }
|
49
|
+
state[:frameworks].collect { |f| f[:completed_tasks].collect { |t| t } }
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
def tasks(framework = nil)
|
53
53
|
results = frameworks.collect do |a|
|
54
54
|
if a[:name] == framework
|
@@ -57,11 +57,11 @@ class MesosCluster
|
|
57
57
|
end
|
58
58
|
results.reject { |r| r.nil? or r.length == 0 }.first
|
59
59
|
end
|
60
|
-
|
61
|
-
def task_ids
|
62
|
-
tasks.collect { |t| t[:id] }
|
60
|
+
|
61
|
+
def task_ids(framework)
|
62
|
+
tasks(framework).collect { |t| t[:id] } if not tasks(framework).nil?
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
def my_tasks_ids(hostname, framework)
|
66
66
|
raise ArgumentError, "missing hostname argument", caller if hostname.nil?
|
67
67
|
new_tasks = tasks(framework)
|
@@ -71,23 +71,23 @@ class MesosCluster
|
|
71
71
|
new_tasks = []
|
72
72
|
end
|
73
73
|
end
|
74
|
-
|
74
|
+
|
75
75
|
def resources
|
76
76
|
state[:frameworks].collect { |f| f[:used_resources] }
|
77
77
|
end
|
78
|
-
|
78
|
+
|
79
79
|
def slave_hostname_by_id(id)
|
80
80
|
slaves.select { |s| s[:id] == id }.first[:hostname]
|
81
81
|
end
|
82
|
-
|
82
|
+
|
83
83
|
def slaves
|
84
84
|
state[:slaves].collect do |s|
|
85
85
|
s.select { |k,v| [:hostname, :id].include?(k)}
|
86
86
|
end
|
87
87
|
end
|
88
|
-
|
88
|
+
|
89
89
|
def to_s
|
90
90
|
JSON.pretty_generate @state
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
end
|
data/lib/panteras_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: panteras_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Colby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01
|
11
|
+
date: 2017-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.8'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: A convenient api for getting information from consul, mesos, marathon,
|
@@ -62,9 +62,9 @@ executables:
|
|
62
62
|
extensions: []
|
63
63
|
extra_rdoc_files: []
|
64
64
|
files:
|
65
|
-
- .gitignore
|
66
|
-
- .rspec
|
67
|
-
- .travis.yml
|
65
|
+
- ".gitignore"
|
66
|
+
- ".rspec"
|
67
|
+
- ".travis.yml"
|
68
68
|
- Gemfile
|
69
69
|
- License
|
70
70
|
- README.md
|
@@ -90,18 +90,19 @@ require_paths:
|
|
90
90
|
- lib
|
91
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- -
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
95
|
version: '0'
|
96
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
|
-
- -
|
98
|
+
- - ">="
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: '0'
|
101
101
|
requirements: []
|
102
102
|
rubyforge_project:
|
103
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.4.6
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Ruby API library for Panteras PaaS platform.
|
107
107
|
test_files: []
|
108
|
+
has_rdoc:
|