Committed by
Gerrit Code Review
Allow output file or '-' for stdout with list of IP addresses
This doesn't seem quite right, because it doesn't match a supposedly legal use case where you omit the output file and list the node IP addresses. However, it's better than what we have now, which simply ignores the output file name. Intended to help with ONOS-4667 Change-Id: Ib46195e7b829bc4d304c4dd51138b73acd4f1501
Showing
1 changed file
with
1 additions
and
1 deletions
... | @@ -55,7 +55,7 @@ if __name__ == '__main__': | ... | @@ -55,7 +55,7 @@ if __name__ == '__main__': |
55 | } | 55 | } |
56 | output = json.dumps(data, indent=4) | 56 | output = json.dumps(data, indent=4) |
57 | 57 | ||
58 | - if len(sys.argv) == 2: | 58 | + if len(sys.argv) >= 2 and sys.argv[1] != '-': |
59 | filename = sys.argv[1] | 59 | filename = sys.argv[1] |
60 | with open(filename, 'w') as f: | 60 | with open(filename, 'w') as f: |
61 | f.write(output) | 61 | f.write(output) | ... | ... |
-
Please register or login to post a comment