diff --git a/katana/sdk/runner.py b/katana/sdk/runner.py index 36edd62..2cc2fce 100644 --- a/katana/sdk/runner.py +++ b/katana/sdk/runner.py @@ -335,16 +335,10 @@ def run(self, **kwargs): self._args = kwargs - # Get input message with action name and payload if available + # Standard input is read only when action name is given message = {} - contents = click.get_text_stream('stdin', encoding='utf8').read() - if contents: - if not kwargs.get('action'): - LOG.error('Action name is missing') - os._exit(EXIT_ERROR) - - # Add action name to message - message['action'] = kwargs['action'] + if kwargs.get('action'): + contents = click.get_text_stream('stdin', encoding='utf8').read() # Add JSON file contents to message try: @@ -353,6 +347,9 @@ def run(self, **kwargs): LOG.exception('Stdin input value is not valid JSON') os._exit(EXIT_ERROR) + # Add action name to message + message['action'] = kwargs['action'] + # Initialize component logging only when `quiet` argument is False, or # if an input message is given init logging only when debug is True if not kwargs.get('quiet'):