From 549d26feb26ac1ffd6ecb8bfedfa4e7d4e1f4eb5 Mon Sep 17 00:00:00 2001 From: Steven Hardy Date: Mon, 26 Nov 2012 18:14:16 +0000 Subject: [PATCH] cfn-json2yaml file-mode bugfix file-mode wasn't working, also add missing header Change-Id: I75d15fd73de4ab3ce679ae3a274ec1c402802267 Signed-off-by: Steven Hardy --- tools/cfn-json2yaml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) mode change 100644 => 100755 tools/cfn-json2yaml diff --git a/tools/cfn-json2yaml b/tools/cfn-json2yaml old mode 100644 new mode 100755 index 19c68610..d816d826 --- a/tools/cfn-json2yaml +++ b/tools/cfn-json2yaml @@ -1,5 +1,19 @@ #!/usr/bin/env python +# vim: tabstop=4 shiftwidth=4 softtabstop=4 +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + import sys import os import yaml @@ -12,13 +26,13 @@ def main(): if os.path.isdir(path): convert_directory(path) elif os.path.isfile(path): - convert_file() + convert_file(path) else: print 'File or directory not valid: %s' % path def convert_file(path): f = open(path, 'r') - print json2yaml(f) + print format.convert_json_to_yaml(f.read()) def convert_directory(dirpath): for path in os.listdir(dirpath): @@ -33,4 +47,4 @@ def convert_directory(dirpath): out.close() if __name__ == '__main__': - main() \ No newline at end of file + main() -- 2.45.2