diff options
author | Scott Moser <smoser@brickies.net> | 2017-07-31 14:46:00 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-07-31 14:46:00 -0400 |
commit | 19c248d009af6a7cff26fbb2febf5c958987084d (patch) | |
tree | 521cc4c8cd303fd7a9eb56bc4eb5975c48996298 /tools/cloudconfig-schema | |
parent | f47c7ac027fc905ca7f6bee776007e2a922c117e (diff) | |
parent | e586fe35a692b7519000005c8024ebd2bcbc82e0 (diff) | |
download | vyos-cloud-init-19c248d009af6a7cff26fbb2febf5c958987084d.tar.gz vyos-cloud-init-19c248d009af6a7cff26fbb2febf5c958987084d.zip |
merge from master at 0.7.9-233-ge586fe35
Diffstat (limited to 'tools/cloudconfig-schema')
-rwxr-xr-x | tools/cloudconfig-schema | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tools/cloudconfig-schema b/tools/cloudconfig-schema new file mode 100755 index 00000000..32f0d61e --- /dev/null +++ b/tools/cloudconfig-schema @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 +# This file is part of cloud-init. See LICENSE file for license information. + +"""cloudconfig-schema + +Validate existing files against cloud-config schema or provide supported schema +documentation. +""" + +import os +import sys + + +def call_entry_point(name): + (istr, dot, ent) = name.rpartition('.') + try: + __import__(istr) + except ImportError: + # if that import failed, check dirname(__file__/..) + # to support ./bin/program with modules in . + _tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) + sys.path.insert(0, _tdir) + try: + __import__(istr) + except ImportError as e: + sys.stderr.write("Unable to find %s: %s\n" % (name, e)) + sys.exit(2) + + sys.exit(getattr(sys.modules[istr], ent)()) + + +if __name__ == '__main__': + call_entry_point("cloudinit.config.schema.main") + +# vi: ts=4 expandtab syntax=python |