From a930c4d8b2aa258c2a848688051ab099a9a450ac Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Tue, 14 Apr 2015 08:36:55 -0400 Subject: [PATCH 1/2] detect invalid license thrown by inventory update --- awx/main/models/inventory.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index a9140eff49..5a6b804684 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -1217,7 +1217,8 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions): def save(self, *args, **kwargs): update_fields = kwargs.get('update_fields', []) if bool(('license' in self.result_stdout or 'licensed' in self.result_stdout) and - 'exceeded' in self.result_stdout and not self.license_error): + 'exceeded' in self.result_stdout and not self.license_error) or \ + bool('License has expired' in self.result_stdout or 'License count exceeded'): self.license_error = True if 'license_error' not in update_fields: update_fields.append('license_error') From 64d4304a97d6b145688d67c1aa8dbf2b2b712f13 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Tue, 14 Apr 2015 10:16:23 -0400 Subject: [PATCH 2/2] flake8 --- awx/main/models/inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/main/models/inventory.py b/awx/main/models/inventory.py index 5a6b804684..7e2464a8bf 100644 --- a/awx/main/models/inventory.py +++ b/awx/main/models/inventory.py @@ -1218,7 +1218,7 @@ class InventoryUpdate(UnifiedJob, InventorySourceOptions): update_fields = kwargs.get('update_fields', []) if bool(('license' in self.result_stdout or 'licensed' in self.result_stdout) and 'exceeded' in self.result_stdout and not self.license_error) or \ - bool('License has expired' in self.result_stdout or 'License count exceeded'): + bool('License has expired' in self.result_stdout or 'License count exceeded'): self.license_error = True if 'license_error' not in update_fields: update_fields.append('license_error')