diff --git a/scripts/cloud-config-to-vendor-data b/scripts/cloud-config-to-vendor-data index 65f6065..34b149a 100755 --- a/scripts/cloud-config-to-vendor-data +++ b/scripts/cloud-config-to-vendor-data @@ -11,12 +11,21 @@ # License for the specific language governing permissions and limitations # under the License. -import sys +import argparse import json +import sys import yaml +parser = argparse.ArgumentParser( + description='Convert a multi-line cloud-config into static vendor data ' + 'format\n: {"cloud-init": }', + formatter_class=argparse.RawTextHelpFormatter +) +parser.add_argument('input_file', type=str) +args = parser.parse_args() + # load from file: -with open(sys.argv[1], 'r') as f: +with open(args.input_file, 'r') as f: yaml_string = f.read() -print json.dumps({"cloud-init":yaml_string}) +print json.dumps({"cloud-init": yaml_string}) diff --git a/scripts/vendor-data-to-cloud-config b/scripts/vendor-data-to-cloud-config index 06155e2..449575a 100755 --- a/scripts/vendor-data-to-cloud-config +++ b/scripts/vendor-data-to-cloud-config @@ -11,12 +11,22 @@ # License for the specific language governing permissions and limitations # under the License. -import sys +import argparse import json +import sys import yaml +parser = argparse.ArgumentParser( + description='Convert a single-line static vendor data file from' + '\n{"cloud-init": }' + '\nto multi-line cloud-config.', + formatter_class=argparse.RawTextHelpFormatter +) +parser.add_argument('input_file', type=str) +args = parser.parse_args() + # load from file: -with open(sys.argv[1], 'r') as f: +with open(args.input_file, 'r') as f: js = json.loads(f.read()) print js['cloud-init']