-
Notifications
You must be signed in to change notification settings - Fork 42
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 initial attempts to automatically clean up dangling hosts #337
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (2)
broker/providers/ansible_tower.py:381
- Check for the existence of 'node.summary_fields["job"]' and 'node.summary_fields["job"]["failed"]' before accessing them to avoid potential KeyError.
if node.summary_fields["job"]["failed"]:
broker/providers/ansible_tower.py:388
- Ensure that 'job' is not None before proceeding to avoid potential AttributeError.
def _try_checkin_dangling_host(self, job):
ed68222
to
6d65d28
Compare
47c310f
to
17b419f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 4 out of 4 changed files in this pull request and generated no suggestions.
Comments skipped due to low confidence (1)
broker/config_manager.py:102
- The condition 'and "example" not in module.name' could be more specific to avoid false positives.
if hasattr(module, "run_migrations") and "example" not in module.__name__:
17b419f
to
8c7ce23
Compare
Now, when workflows fail, Broker will attempt to find a handgling host and check it in if found.
8c7ce23
to
e46159d
Compare
@@ -127,6 +128,7 @@ class AnsibleTower(Provider): | |||
| Validator("ANSIBLETOWER.token", must_exist=True) | |||
), | |||
Validator("ANSIBLETOWER.inventory", default=None), | |||
Validator("ANSIBLETOWER.dangling_behavior", default="checkin"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validator("ANSIBLETOWER.dangling_behavior", default="checkin"), | |
Validator("ANSIBLETOWER.dangling_behavior", default="checkin", is_in=["prompt", "checkin", "store"]), |
logger.debug(f"Storing dangling host: {dangling_host}") | ||
host = self._v2.hosts.get(name=dangling_host).results[0] | ||
host = self._compile_host_info(host) | ||
host["failed"] = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
host["failed"] = True | |
host["deploy_failed"] = True |
I prefer to be a bit more explicit about what failed.
Now, when workflows fail, Broker will attempt to find a dangling host and check it in if found.