aboutsummaryrefslogtreecommitdiffstats
path: root/tripleo_heat_merge
diff options
context:
space:
mode:
authorRobert Collins <rbtcollins@hp.com>2014-01-28 19:18:57 +1300
committerRobert Collins <rbtcollins@hp.com>2014-01-29 01:39:24 +1300
commit0757603f2ec10223a99de17123cfd9c1a6a815af (patch)
tree31a71ec847ad6cdd4f3f0fff8198baee73046228 /tripleo_heat_merge
parent6cecaac6a3257d422568f25c3b832c347a98ff92 (diff)
Permit writing output to other than stdout.
Change-Id: I8349f347578bab564e4c37ee2c87314881e09b01
Diffstat (limited to 'tripleo_heat_merge')
-rw-r--r--tripleo_heat_merge/merge.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tripleo_heat_merge/merge.py b/tripleo_heat_merge/merge.py
index 053a683a..2975bd02 100644
--- a/tripleo_heat_merge/merge.py
+++ b/tripleo_heat_merge/merge.py
@@ -89,11 +89,18 @@ def main(argv=None):
parser.add_argument('--included-template-dir', nargs='?',
default=INCLUDED_TEMPLATE_DIR,
help='Path for resolving included templates')
+ parser.add_argument('--output',
+ help='File to write output to. - for stdout',
+ default='-')
args = parser.parse_args(argv)
templates = args.templates
merged_template = merge(templates, args.master_role, args.slave_roles,
args.included_template_dir)
- sys.stdout.write(merged_template)
+ if args.output == '-':
+ out_file = sys.stdout
+ else:
+ out_file = file(args.output, 'wt')
+ out_file.write(merged_template)
def merge(templates, master_role=None, slave_roles=None,
included_template_dir=INCLUDED_TEMPLATE_DIR):