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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23c7a44026357d3e3f3e45358ec6093963bbca8e
4
- data.tar.gz: ec55ee61654b8b72bf8c7dc571e3a25734c3579a
3
+ metadata.gz: 392e06687d27e5473e29fd461cb3bd55884708f3
4
+ data.tar.gz: bdfa6997e7828349730f4699b39959a6dae2ad40
5
5
  SHA512:
6
- metadata.gz: 06a26dd418e3854058515df7743d6bb2b9b5790d2290f2cad16cc190dc04130510bff5f342ad93bd82968e4c3b048a3ba1baf2f1147a3e9c17d645bc3a7aa613
7
- data.tar.gz: 5150ab5cb237b4841570fa70216b34c7d303f377998bb32a050413dc3087f17ecfa6ad9ba0fc9b8d1efb1d4fbafe0282858e8c78f65a342c9bb7115e11bb8526
6
+ metadata.gz: 068b56f1d0372710128a6662405ee4efbefafdcc5dc12c01281459ab9df393145a9a7ac474ed67e3825de92ceeb0d0948ac61afd29c43716d63d390b35579869
7
+ data.tar.gz: 87fcfa7f7ba6a51df8e487270e947827624d536f631b1979ffaf87ec25608c3a2697d4e7e11fb1f466362066abb85c3b7f714279eac4b3cfce343a1396db10ef
@@ -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["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
-
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
- @logger.debug "No health check results - ignoring task #{task}"
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
- end
94
-
95
- # cleanup
96
- ports.reject! do |host|
97
-
98
- host[:services].reject! {|protocol, services| services.size == 0 }
99
- host[:services].size == 0
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
 
@@ -1,5 +1,5 @@
1
1
  module Marathon
2
2
  module Srv
3
- VERSION = "1.0.3"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marathon-srv
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andras Szerdahelyi