maybe I am making a simple mistake here… it is friday afternoon.
function:def run(params={}):
input = params.get(“input”)
split_string = input.split(":")
output_dict = {}
for s in split_string:
split_element = s.strip().split(" “)
if len(split_element) > 1:
output_dict[split_element[0]]=” ".join(split_element[1:])
return output_dict
print(run({“input”:input}))
input:Identifier: 6abca32a Device Name: [devicenamehere] Username: [test\testy] Department: []
and ERRRORRRRR
(‘action input JSON was invalid’, <ValidationError: “‘Identifier: 6abca32a Device Name: [devicenamehere] Username: [test\\testy] Department: []’ is not of type ‘object’”>)
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/komand-1.0.1-py3.7.egg/komand/plugin.py”, line 380, in start_step
step.input.validate(params)
File “/usr/local/lib/python3.7/site-packages/komand-1.0.1-py3.7.egg/komand/variables.py”, line 24, in validate
validate(parameters, self.schema)
File “/usr/local/lib/python3.7/site-packages/jsonschema-2.3.0-py3.7.egg/jsonschema/validators.py”, line 432, in validate
cls(schema, *args, **kwargs).validate(instance)
File “/usr/local/lib/python3.7/site-packages/jsonschema-2.3.0-py3.7.egg/jsonschema/validators.py”, line 117, in validate
raise error
jsonschema.exceptions.ValidationError: ‘Identifier: 6abca32a Device Name: [devicenamehere] Username: [test\testy] Department: []’ is not of type ‘object’
Failed validating ‘type’ in schema[‘properties’][‘input’]:
{‘description’: 'Input object to be passed as params={}
to the run
’
‘function’,
‘order’: 2,
‘title’: ‘Input’,
‘type’: ‘object’}
On instance[‘input’]:
('Identifier: 6abca32a Device Name: [devicenamehere] Username: ’
‘[test\testy] Department: []’)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/komand-1.0.1-py3.7.egg/komand/plugin.py”, line 311, in handle_step
output = self.start_step(input_message[‘body’], ‘action’, logger, log_stream, is_test, is_debug)
File “/usr/local/lib/python3.7/site-packages/komand-1.0.1-py3.7.egg/komand/plugin.py”, line 387, in start_step
raise ClientException(’{} input JSON was invalid’.format(step_key), e)
komand.exceptions.ClientException: (‘action input JSON was invalid’, <ValidationError: “‘Identifier: 6abca32a Device Name: [devicenamehere] Username: [test\\testy] Department: []’ is not of type ‘object’”>)