marathon-srv 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/marathon/srv/client.rb +32 -29
- data/lib/marathon/srv/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 392e06687d27e5473e29fd461cb3bd55884708f3
|
4
|
+
data.tar.gz: bdfa6997e7828349730f4699b39959a6dae2ad40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 068b56f1d0372710128a6662405ee4efbefafdcc5dc12c01281459ab9df393145a9a7ac474ed67e3825de92ceeb0d0948ac61afd29c43716d63d390b35579869
|
7
|
+
data.tar.gz: 87fcfa7f7ba6a51df8e487270e947827624d536f631b1979ffaf87ec25608c3a2697d4e7e11fb1f466362066abb85c3b7f714279eac4b3cfce343a1396db10ef
|
data/lib/marathon/srv/client.rb
CHANGED
@@ -60,46 +60,49 @@ module Marathon
|
|
60
60
|
|
61
61
|
@logger.debug "Retrieved app object #{app}"
|
62
62
|
|
63
|
-
raise Marathon::Srv::NotDockerContainerizedApplicationError.new unless app["container"]["type"] == "DOCKER"
|
64
|
-
raise Marathon::Srv::NoRunningTasksFoundError.new unless app["tasks"].size > 0
|
65
63
|
raise Marathon::Srv::NoHealthChecksDefinedError.new unless healthy_tasks_only == false || (app["healthChecks"] != nil && app["healthChecks"].size > 0)
|
66
64
|
|
67
|
-
# collect slave ports of (healthy) tasks
|
68
65
|
ports=[]
|
69
|
-
if (app["
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
task["healthCheckResults"]
|
78
|
-
|
79
|
-
|
66
|
+
if (app["container"]["type"] == "DOCKER")
|
67
|
+
|
68
|
+
# collect slave ports of (healthy) tasks
|
69
|
+
if (app["tasks"] != nil)
|
70
|
+
app["tasks"].each do |task|
|
71
|
+
|
72
|
+
if(healthy_tasks_only)
|
73
|
+
@logger.debug "Verifying health checks for task #{task}"
|
74
|
+
if (task["healthCheckResults"] != nil)
|
75
|
+
# all health checks must be passing
|
76
|
+
passing=true
|
77
|
+
task["healthCheckResults"].each do |health_check_result|
|
78
|
+
(passing=false; @logger.debug "%s has failing health check, not considering it" % task; break) unless health_check_result["alive"] == true
|
79
|
+
|
80
|
+
end
|
81
|
+
(@logger.debug "All health checks passing - filtering ports for task #{task}"; ports.push filter_ports(app, task, filter_ports)) if passing
|
82
|
+
else
|
83
|
+
@logger.debug "No health check results - ignoring task #{task}"
|
80
84
|
end
|
81
|
-
(@logger.debug "All health checks passing - filtering ports for task #{task}"; ports.push filter_ports(app, task, filter_ports)) if passing
|
82
85
|
else
|
83
|
-
|
86
|
+
# just add task
|
87
|
+
@logger.debug "Ignoring health checks - filtering ports for task #{task}"
|
88
|
+
ports.push filter_ports(app, task, filter_ports)
|
89
|
+
|
84
90
|
end
|
85
|
-
else
|
86
|
-
# just add task
|
87
|
-
@logger.debug "Ignoring health checks - filtering ports for task #{task}"
|
88
|
-
ports.push filter_ports(app, task, filter_ports)
|
89
91
|
|
90
92
|
end
|
91
|
-
|
92
93
|
end
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
|
95
|
+
# cleanup
|
96
|
+
ports.reject! do |host|
|
97
|
+
|
98
|
+
host[:services].reject! {|protocol, services| services.size == 0 }
|
99
|
+
host[:services].size == 0
|
100
|
+
|
101
|
+
end
|
102
|
+
|
100
103
|
|
101
104
|
end
|
102
|
-
|
105
|
+
|
103
106
|
@logger.debug "Collected ports #{ports} for #{app["id"]}"
|
104
107
|
app_ports[app["id"]] = ports
|
105
108
|
|
data/lib/marathon/srv/version.rb
CHANGED