mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
salt uses YAML, why am I using JSON?!
This commit is contained in:
parent
bbb5efb308
commit
5d84cdfbf8
9 changed files with 12 additions and 20 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"description": "Execution module",
|
||||
"version": "Carbon",
|
||||
}
|
2
templates/module/template.yml
Normal file
2
templates/module/template.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
description: "Execution module"
|
||||
version: "Carbon"
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"description": "Execution module unit test",
|
||||
"version": "Carbon",
|
||||
}
|
2
templates/module_test/template.yml
Normal file
2
templates/module_test/template.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
description: "Execution module unit test"
|
||||
version: "Carbon"
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"description": "State module",
|
||||
"version": "Carbon",
|
||||
}
|
2
templates/state/template.yml
Normal file
2
templates/state/template.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
description: "State module"
|
||||
version: "Carbon"
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"description": "Unit tests for a state module",
|
||||
"version": "Carbon",
|
||||
}
|
2
templates/state_test/template.yml
Normal file
2
templates/state_test/template.yml
Normal file
|
@ -0,0 +1,2 @@
|
|||
description: "State module unit test"
|
||||
version: "Carbon"
|
Loading…
Add table
Reference in a new issue