salt uses YAML, why am I using JSON?!

This commit is contained in:
Anthony Shaw 2016-07-27 13:49:46 +10:00
parent bbb5efb308
commit 5d84cdfbf8
9 changed files with 12 additions and 20 deletions

View file

@ -3,7 +3,7 @@
SaltStack Extend
'''
from __future__ import absolute_import
import json
import yaml
from collections import OrderedDict
from datetime import date
import tempfile
@ -26,16 +26,16 @@ def _fetch_templates(src):
for item in os.listdir(src):
s = os.path.join(src, item)
if os.path.isdir(s):
template_path = os.path.join(s, 'template.json')
template_path = os.path.join(s, 'template.yml')
if os.path.isfile(template_path):
try:
with open(template_path, "r") as template_f:
template = json.load(template_f)
template = yaml.load(template_f)
templates.append((item, template.get('description','')))
except:
log.error("Could not load template {0}".format(template_path))
else:
log.debug("Directory does not contain template.json {0}".format(template_path))
log.debug("Directory does not contain template.yml {0}".format(template_path))
return templates

View file

@ -1,4 +0,0 @@
{
"description": "Execution module",
"version": "Carbon",
}

View file

@ -0,0 +1,2 @@
description: "Execution module"
version: "Carbon"

View file

@ -1,4 +0,0 @@
{
"description": "Execution module unit test",
"version": "Carbon",
}

View file

@ -0,0 +1,2 @@
description: "Execution module unit test"
version: "Carbon"

View file

@ -1,4 +0,0 @@
{
"description": "State module",
"version": "Carbon",
}

View file

@ -0,0 +1,2 @@
description: "State module"
version: "Carbon"

View file

@ -1,4 +0,0 @@
{
"description": "Unit tests for a state module",
"version": "Carbon",
}

View file

@ -0,0 +1,2 @@
description: "State module unit test"
version: "Carbon"