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
Introduce public methods to access PlayIterator._host_states #74416
Conversation
ea74f48
to
40aa705
Compare
raise AnsibleAssertionError('Expected run_state to be a IteratingStates but was %s' % (type(run_state))) | ||
self._host_states[hostname].run_state = run_state | ||
|
||
def set_fail_state_for_host(self, hostname, fail_state): |
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.
An alternative would be to have clear_fail_state_for_host
that would set fail_state
to FailedState.NONE
and set_fail_state_for_host
that would do fail_state |= ...
. But it is not needed at the moment, so ¯_(ツ)_/¯
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.
Agreed, this is another long-needed change; also allows us to intercept/log these changes in the future for $reasons much easier than attrs did. Change looks good, just an open question if we want to add type annotations on the new public methods.
self._host_states[host.name] = self._insert_tasks_into_state(self.get_host_state(host), task_list) | ||
self.set_state_for_host(host.name, self._insert_tasks_into_state(self.get_host_state(host), task_list)) | ||
|
||
def set_state_for_host(self, hostname, state): |
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.
Since this is new public API that's 3.8+, any reason we shouldn't type annotate these methods?
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.
+1, added.
40aa705
to
efd4cad
Compare
SUMMARY
Per #74175 (comment)
ci_complete
ISSUE TYPE
COMPONENT NAME
lib/ansible/executor/play_iterator.py