Convert packer.json builder to python

This commit is contained in:
Mike Crute 2020-05-28 13:21:11 -07:00
parent 7e60c7fb6a
commit bfc4bf99bf
1 changed files with 20 additions and 0 deletions

View File

@ -568,6 +568,26 @@ class UpdateReleases:
yaml.dump(releases, data, sort_keys=False)
class ConvertPackerJSON:
"""Convert packer.conf to packer.json
"""
command_name = "convert-packer-config"
@staticmethod
def add_args(parser):
pass
def run(self, args, root):
source = os.path.join(root, "packer.conf")
dest = os.path.join(root, "build", "packer.json")
logging.getLogger().setLevel(logging.INFO)
pyhocon.converter.HOCONConverter.convert_from_file(
source, dest, "json", 2, False)
def find_repo_root():
path = os.getcwd()