Skip to content

Commit 0d6a453

Browse files
committed
handle cases where Command function does NOT return typical 3-tuple
1 parent 5e4d293 commit 0d6a453

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

qiita_client/plugin.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,17 @@ def _push_artifacts_files_to_central(qclient, artifacts):
137137

138138
def __call__(self, qclient, server_url, job_id, output_dir):
139139
logger.debug('Entered QiitaCommand.__call__()')
140-
status, artifacts, error_message = self.function(
140+
results = self.function(
141141
qclient, server_url, job_id, output_dir)
142-
return status, QiitaCommand._push_artifacts_files_to_central(
143-
qclient, artifacts), error_message
142+
# typical, but not all, functions of QiitaCommands return 3-tuple
143+
# status=bool, list of artifacts, error_message=str
144+
if isinstance(results, tuple) and (len(results) == 3) and \
145+
isinstance(results[0], bool) and \
146+
isinstance(results[1], list) and \
147+
isinstance(results[2], str):
148+
results[1] = QiitaCommand._push_artifacts_files_to_central(
149+
qclient, results[1])
150+
return results
144151

145152

146153
class QiitaArtifactType(object):

0 commit comments

Comments
 (0)