Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check_instance_ready management command #15238

Merged
merged 1 commit into from
May 31, 2024

Conversation

TheRealHaoLiu
Copy link
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
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
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
21 checks passed
@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