Skip to content

Commit

Permalink
Fix isolate failed backends when regenerating config (d2iq-archive#24) (
Browse files Browse the repository at this point in the history
d2iq-archive#28)

* Fix isolate failed backends when regenerating config

* Update changelog
  • Loading branch information
manriquecms authored Feb 22, 2018
1 parent 3f6d24e commit 57043ec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.3.1 (upcoming)

* Fix isolate failed backends when regenerating config

## 0.3.0 (February 20, 2018)

* [EOS-987] Marathon-lb-sec logging format should comply with standard
Expand Down
17 changes: 14 additions & 3 deletions marathon_lb.py
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,9 @@ def make_config_valid_and_regenerate(marathon, groups, bind_http_https,
marathon_apps = marathon.list()
apps = []
excluded_ids = []
final_generated_config = ""
final_domain_map_array = []
final_app_map_array = []

for app in marathon_apps:
valid_marathon_apps.append(app)
Expand All @@ -1617,14 +1620,22 @@ def make_config_valid_and_regenerate(marathon, groups, bind_http_https,

if len(valid_marathon_apps) == 0:
apps = []
else:
final_generated_config = generated_config
final_domain_map_array = domain_map_array
final_app_map_array = app_map_array

if len(valid_marathon_apps) > 0:
logger.debug("regentrating valid config which excludes the"
"following apps: %s", excluded_ids)
compareWriteAndReloadConfig(generated_config,

(changed, config_valid) = compareWriteAndReloadConfig(final_generated_config,
config_file,
domain_map_array,
app_map_array, haproxy_map)
final_domain_map_array,
final_app_map_array, haproxy_map)
#Force reload
reloadConfig()

else:
logger.error("A valid config file could not be generated after"
"excluding all apps! skipping reload")
Expand Down

0 comments on commit 57043ec

Please sign in to comment.