Index: recipe_engine/stream.py |
diff --git a/recipe_engine/stream.py b/recipe_engine/stream.py |
index 831e69b0e9bfab75ca31cbae0cfe30f152bf4f26..194ea3aba1c0f2c24ce86d5566b2a736aca3e47c 100644 |
--- a/recipe_engine/stream.py |
+++ b/recipe_engine/stream.py |
@@ -93,6 +93,7 @@ class StreamEngine(object): |
def make_step_stream(self, name, **kwargs): |
"""Shorthand for creating a step stream from a step configuration dict.""" |
+ assert '\n' not in name, 'Stream name must not contain a newline.' |
kwargs['name'] = name |
return self.new_step_stream(recipe_api.StepConfig.create(**kwargs)) |
@@ -314,7 +315,7 @@ class StreamEngineInvariants(StreamEngine): |
self._status = 'SUCCESS' |
def write_line(self, line): |
- assert '\n' not in line |
+ assert '\n' not in line, 'Individual line must not contain a newline.' |
assert self._open |
def close(self): |
@@ -328,19 +329,22 @@ class StreamEngineInvariants(StreamEngine): |
assert self._open |
assert log_name not in self._logs, 'Log %s already exists in step %s' % ( |
log_name, self._step_name) |
+ assert '\n' not in log_name, 'Log name must not contain a newline.' |
ret = self._engine.LogStream(self, log_name) |
self._logs[log_name] = ret |
return ret |
def add_step_text(self, text): |
- pass |
+ assert '\n' not in text, 'Step text must not contain a newline.' |
def add_step_summary_text(self, text): |
- pass |
+ assert '\n' not in text, 'Step summary text must not contain a newline.' |
def add_step_link(self, name, url): |
assert isinstance(name, basestring), 'Link name %s is not a string' % name |
- assert isinstance(url, basestring), 'Link url %s is not a string' % url |
+ assert '\n' not in name, 'Link name must not contain a newline.' |
+ assert isinstance(url, basestring), 'Link URL %s is not a string' % url |
+ assert '\n' not in url, 'Link URL must not contain a newline.' |
iannucci
2017/04/05 02:40:23
Since these values are user-controlled (i.e. they
dnj
2017/04/05 15:08:07
Done.
|
def set_step_status(self, status): |
assert status in ('SUCCESS', 'WARNING', 'FAILURE', 'EXCEPTION') |
@@ -351,11 +355,13 @@ class StreamEngineInvariants(StreamEngine): |
self._status = status |
def set_build_property(self, key, value): |
- pass |
+ assert '\n' not in key, 'Property key must not contain a newline.' |
+ assert '\n' not in value, 'Property value must not contain a newline.' |
+ json.loads(value) # value must be a valud JSON object. |
iannucci
2017/04/05 02:40:23
nit: valud
dnj
2017/04/05 15:08:07
Done.
|
def trigger(self, spec): |
- assert '\n' not in spec # Spec must fit on one line. |
- json.loads(spec) # Spec must be a valid json object. |
+ assert '\n' not in spec, 'Spec must not contain a newline.' |
+ json.loads(spec) # Spec must be a valid JSON object. |
class LogStream(StreamEngine.Stream): |
def __init__(self, step_stream, log_name): |
@@ -364,7 +370,7 @@ class StreamEngineInvariants(StreamEngine): |
self._open = True |
def write_line(self, line): |
- assert '\n' not in line |
+ assert '\n' not in line, 'Inividual line must not contain a newline.' |
assert self._step_stream._open |
assert self._open |