Skip to content

Commit

Permalink
Better error message when piping no data on "om <path> create --confi…
Browse files Browse the repository at this point in the history
…g=-"

This scenario produced a 'local variable 'data' referenced before assignment'
unrelevant message.

With patch:

$ echo -n | om c25svc4 create --env port=8003 --config=-
empty feed

Which closes #21
  • Loading branch information
cvaroqui committed Dec 2, 2019
1 parent 5c8359d commit 1a3e3a2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/node.py
Expand Up @@ -2943,11 +2943,14 @@ def svc_conf_from_stdin(self):
feed = ""
for line in sys.stdin.readlines():
feed += line
data = None
if feed:
try:
data = json.loads("".join(feed))
except ValueError:
raise ex.excError("invalid json feed")
else:
raise ex.excError("empty feed")
return data

def svc_conf_from_selector(self, selector):
Expand Down

0 comments on commit 1a3e3a2

Please sign in to comment.