mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 15:27:47 -02:30
Fixing incorrect license_error value in inventory_sync.
Signed-off-by: Yunfan Zhang <yz322@duke.edu>
This commit is contained in:
@@ -1005,6 +1005,9 @@ class Command(BaseCommand):
|
|||||||
self.all_group.debug_tree()
|
self.all_group.debug_tree()
|
||||||
|
|
||||||
with batch_role_ancestor_rebuilding():
|
with batch_role_ancestor_rebuilding():
|
||||||
|
# If using with transaction.atomic() with try ... catch,
|
||||||
|
# with transaction.atomic() must be inside the try section of the code as per Django docs
|
||||||
|
try:
|
||||||
# Ensure that this is managed as an atomic SQL transaction,
|
# Ensure that this is managed as an atomic SQL transaction,
|
||||||
# and thus properly rolled back if there is an issue.
|
# and thus properly rolled back if there is an issue.
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
@@ -1023,10 +1026,13 @@ class Command(BaseCommand):
|
|||||||
if settings.SQL_DEBUG:
|
if settings.SQL_DEBUG:
|
||||||
logger.warning('update computed fields took %d queries',
|
logger.warning('update computed fields took %d queries',
|
||||||
len(connection.queries) - queries_before2)
|
len(connection.queries) - queries_before2)
|
||||||
try:
|
# Check if the license is valid.
|
||||||
|
# If the license is not valid, a CommandError will be thrown,
|
||||||
|
# and inventory update will be marked as invalid.
|
||||||
|
# with transaction.atomic() will roll back the changes.
|
||||||
self.check_license()
|
self.check_license()
|
||||||
except CommandError as e:
|
except CommandError as e:
|
||||||
self.mark_license_failure(save=True)
|
self.mark_license_failure()
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
if settings.SQL_DEBUG:
|
if settings.SQL_DEBUG:
|
||||||
|
|||||||
Reference in New Issue
Block a user