Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
No need to query for the latest tls settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattk42 committed Jun 6, 2017
1 parent e2baf85 commit 0b67ef1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rootfs/api/models/tls.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,13 @@ def save(self, *args, **kwargs):
def sync(self):
try:
app = str(self.app)
previous_tls_settings = self.app.tls_set.latest()

config = self._load_service_config(app, 'router')
if (
config['ssl']['enforce'] != str(previous_tls_settings.https_enforced) and
previous_tls_settings.https_enforced is not None
config['ssl']['enforce'] != str(self.https_enforced) and
self.https_enforced is not None
):
config['ssl']['enforce'] = str(previous_tls_settings.https_enforced)
config['ssl']['enforce'] = str(self.https_enforced)
self._save_service_config(app, 'router', config)
except TLS.DoesNotExist:
pass

0 comments on commit 0b67ef1

Please sign in to comment.