Skip to content

Add check_instance_ready management command#15238

Merged
TheRealHaoLiu merged 1 commit intoansible:develfrom
TheRealHaoLiu:check-instance-ready
May 31, 2024
Merged

Add check_instance_ready management command#15238
TheRealHaoLiu merged 1 commit intoansible:develfrom
TheRealHaoLiu:check-instance-ready

Conversation

@TheRealHaoLiu
Copy link
Copy Markdown
Member

@TheRealHaoLiu TheRealHaoLiu commented May 30, 2024

SUMMARY
  • throw exception and return 1 if instance not ready
  • return 0 if ready

use by ansible/awx-operator#1885

ISSUE TYPE
  • New or Enhanced Feature
COMPONENT NAME
  • API
AWX VERSION

ADDITIONAL INFORMATION


def handle(self, *args, **options):
if Instance.objects.me().node_state != Instance.States.READY:
raise Exception('Instance is not ready') # so that return code is not 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The correct way to exit out of Django commands with a failure is to raise CommandError (from django.core.management.base)

@TheRealHaoLiu
Copy link
Copy Markdown
Member Author

Thx for the review. Incorporated the suggestion plz rereview

- throw exception and return 1 if instance not ready
- return 0 if ready

Update check_instance_ready.py

Update check_instance_ready.py
@TheRealHaoLiu TheRealHaoLiu force-pushed the check-instance-ready branch from b8a8b1b to e6ca6dd Compare May 31, 2024 13:09
@TheRealHaoLiu TheRealHaoLiu merged commit d0fe0ed into ansible:devel May 31, 2024
@TheRealHaoLiu TheRealHaoLiu deleted the check-instance-ready branch May 31, 2024 13:29
djyasin pushed a commit to djyasin/awx that referenced this pull request Sep 16, 2024
- throw exception and return 1 if instance not ready
- return 0 if ready
djyasin pushed a commit to djyasin/awx that referenced this pull request Nov 11, 2024
- throw exception and return 1 if instance not ready
- return 0 if ready
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants