Comment 12 for bug 1252359

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is broken by:

commit 4614cd7948b24786ea46dd21468d5d45e00d5593
Author: Sylvain Pineau <email address hidden>
Date: Thu Oct 10 18:30:05 2013 +0200

    plainbox:runner: Non automated jobs return OUTCOME_UNDECIDED

    To let the client set the outcome, non automated jobs use this special
    value to trigger the corresponding interaction.

    The manual and user-interact plugins now return a MemoryJobResult
    containing {'outcome': IJobResult.OUTCOME_UNDECIDED}).

    The user-verify and user-interact-verify only alter the outcome of the
    prerun command result, this way we preserve all logs and associated state.

diff --git a/plainbox/plainbox/impl/runner.py b/plainbox/plainbox/impl/runner.py
index 91e1246..21e96dd 100644
--- a/plainbox/plainbox/impl/runner.py
+++ b/plainbox/plainbox/impl/runner.py
@@ -376,7 +376,7 @@ class JobRunner(IJobRunner):
         """
         if job.plugin != "manual":
             raise ValueError("bad job plugin value")
- return self._call_interaction_callback(job, config)
+ return MemoryJobResult({'outcome': IJobResult.OUTCOME_UNDECIDED})

     def run_user_interact_job(self, job, config):
         """
@@ -416,7 +416,7 @@ class JobRunner(IJobRunner):
         """
         if job.plugin != "user-interact":
             raise ValueError("bad job plugin value")
- return self._just_run_command(job, config)
+ return MemoryJobResult({'outcome': IJobResult.OUTCOME_UNDECIDED})

     def run_user_verify_job(self, job, config):
         """
@@ -464,14 +464,7 @@ class JobRunner(IJobRunner):
         # Run the command
         result_cmd = self._just_run_command(job, config)
         # Maybe ask the user
- result_user = self._call_interaction_callback(job, config)
- # FIXME: result_user must never be None -- it is currently broken in
- # the existing service/highlevel code as emitAskForOutcomeSignal()
- # doesn't return anything.
- if result_user is not None:
- # Copy whatever user has decided over to the command result. This
- # way we preserve all logs and associated state.
- result_cmd.outcome = result_user.outcome
+ result_cmd.outcome = IJobResult.OUTCOME_UNDECIDED
         return result_cmd

     def run_user_interact_verify_job(self, job, config):
@@ -521,14 +514,7 @@ class JobRunner(IJobRunner):
         # Run the command
         result_cmd = self._just_run_command(job, config)
         # Maybe ask the user
- result_user = self._call_interaction_callback(job, config)
- # FIXME: result_user must never be None -- it is currently broken in
- # the existing service/highlevel code as emitAskForOutcomeSignal()
- # doesn't return anything.
- if result_user is not None:
- # Copy whatever user has decided over to the command result. This
- # way we preserve all logs and associated state.
- result_cmd.outcome = result_user.outcome
+ result_cmd.outcome = IJobResult.OUTCOME_UNDECIDED
         return result_cmd

     def _call_interaction_callback(self, job, config):