Skip to content

Commit 4989fb3

Browse files
committed
feat: pass verify_completion_state to verify_deploy controller callbacks.
Signed-off-by: Yuki Ito <yuki462@ibm.com>
1 parent f972b47 commit 4989fb3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

oper8/controller.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,10 @@ def after_deploy_unsuccessful(self, session: Session, failed: bool, deploy_compl
190190
"""
191191
return True
192192

193-
# TODO get verify_completion_state
194193
def after_verify(
195194
self,
196195
session: Session, # pylint: disable=unused-argument
196+
verify_completion_state: CompletionState
197197
) -> bool:
198198
"""This allows children to inject logic that will run when the
199199
controller has finished verifying all components. The default behavior
@@ -202,6 +202,8 @@ def after_verify(
202202
Args:
203203
session: Session
204204
The current reconciliation session
205+
verify_completion_state: CompletionState
206+
Completion state of the last verification
205207
206208
Returns:
207209
success: bool
@@ -210,7 +212,7 @@ def after_verify(
210212
"""
211213
return True
212214

213-
def after_verify_unsuccessful(self, session: Session, failed: bool) -> bool:
215+
def after_verify_unsuccessful(self, session: Session, failed: bool, verify_completion_state: CompletionState) -> bool:
214216
"""This allows children to inject logic that will run when the
215217
controller has finished deploying all components but failed to verify.
216218
The default behavior is a no-op.
@@ -220,6 +222,8 @@ def after_verify_unsuccessful(self, session: Session, failed: bool) -> bool:
220222
The current reconciliation session
221223
failed: bool
222224
Indicator of whether or not the termination was a failure
225+
verify_completion_state: CompletionState
226+
Completion state of the last verification
223227
224228
Returns:
225229
success: bool

oper8/rollout_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ def rollout( # pylint: disable=too-many-locals,too-many-statements
436436
log.debug("Running after-verify-unsuccessful")
437437
try:
438438
is_after_verify_unsuccessful_completed = (
439-
self._after_verify_unsuccessful(self._session, phase3_failed)
439+
self._after_verify_unsuccessful(self._session, phase3_failed, verify_completion_state)
440440
)
441441
if not is_after_verify_unsuccessful_completed:
442442
phase4_exception = VerificationError(
@@ -450,7 +450,7 @@ def rollout( # pylint: disable=too-many-locals,too-many-statements
450450
if phase3_complete and self._after_verify:
451451
log.debug("Running after-verify")
452452
try:
453-
phase4_complete = self._after_verify(self._session)
453+
phase4_complete = self._after_verify(self._session, verify_completion_state)
454454
if not phase4_complete:
455455
phase4_exception = VerificationError("After-verify failed")
456456
except Exception as err: # pylint: disable=broad-except

0 commit comments

Comments
 (0)