summaryrefslogtreecommitdiffstats
path: root/repackage/bin/yamltojson
diff options
context:
space:
mode:
authorTony Hansen <tony@att.com>2017-09-29 02:03:39 +0000
committerTony Hansen <tony@att.com>2017-09-29 02:03:53 +0000
commit16a1fcbc814ec20e59cbe95cb506bca29f104208 (patch)
treefaef0c5a6b382a22943f35774f8469f75d0e2b88 /repackage/bin/yamltojson
parent8cdeeeb9a2e8b51f9897173dc26d672e55b00304 (diff)
remove check-blueprint-vs-input, repackage
check-blueprint-vs-input was moved to blueprints module repackage was moved to ccsdk/pgaas module Change-Id: If9d04d4ee1c0e5a3a2b837fc253c00dee226a2ac Signed-off-by: Tony Hansen <tony@att.com> Issue-ID: DCAEGEN2-49
Diffstat (limited to 'repackage/bin/yamltojson')
-rwxr-xr-xrepackage/bin/yamltojson39
1 files changed, 0 insertions, 39 deletions
diff --git a/repackage/bin/yamltojson b/repackage/bin/yamltojson
deleted file mode 100755
index 0dc85fc..0000000
--- a/repackage/bin/yamltojson
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env python3
-# -*- indent-tabs-mode: nil -*- vi: set expandtab:
-
-"""
-NAME
- yamltojson - convert a yaml file to a json file
-
-SYNOPSIS
- yamltojson file.yaml ...
-
-DESCRIPTION
- Read in a yaml file (whose name must end with ".yaml") and create cor‐
- responding json files, whose names will end with ".json".
-"""
-
-import sys, re, yaml
-try:
- import simplejson as json
-except:
- import json
-
-def die(msg):
- """ generate a FATAL message to stdout and exit """
- print("%s:FATAL:%s" % (date(), msg))
- sys.exit(2)
-
-for fname in sys.argv[1:]:
- if fname.endswith(".yaml"):
- y = None
- with open(fname, "r") as fd:
- try:
- contents = fd.read()
- contents = re.sub("^\t+", " ", contents, flags=re.M)
- y = yaml.safe_load(contents)
- except:
- die("Invalid yaml in '%s'" % fname)
- jsonfname = fname[:-5] + ".json"
- with open(jsonfname, "w") as fd:
- json.dump(y, fd, indent=4, sort_keys=True)