Skip to content

Commit

Permalink
Issue #8053
Browse files Browse the repository at this point in the history
- YAML exceptions are now re-reaised as SaltRenderErrors
- Duplicate ID's in single state files now result in errors, and not
  just warnings. This is now consistent with the how conflicting ID's in
  separate state files are handled.
  • Loading branch information
emilisto authored and basepi committed Nov 19, 2013
1 parent b164484 commit 8449dec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 3 additions & 0 deletions salt/renderers/yaml.py
Expand Up @@ -5,6 +5,7 @@
import logging
import warnings
from yaml.scanner import ScannerError
from yaml.constructor import ConstructorError

# Import salt libs
from salt.utils.yamlloader import CustomLoader, load
Expand Down Expand Up @@ -44,6 +45,8 @@ def render(yaml_data, env='', sls='', argline='', **kws):
err_type = _ERROR_MAP.get(exc.problem, 'Unknown yaml render error')
line_num = exc.problem_mark.line + 1
raise SaltRenderError(err_type, line_num, exc.problem_mark.buffer)
except ConstructorError as exc:
raise SaltRenderError(exc)
if len(warn_list) > 0:
for item in warn_list:
log.warn(
Expand Down
3 changes: 1 addition & 2 deletions salt/utils/yamlloader.py
Expand Up @@ -77,8 +77,7 @@ def construct_mapping(self, node, deep=False):
raise ConstructorError(err)
value = self.construct_object(value_node, deep=deep)
if key in mapping:
warnings.warn(
'Duplicate Key: "{0}"'.format(key), DuplicateKeyWarning)
raise ConstructorError('Conflicting ID "{0}"'.format(key))
mapping[key] = value
return mapping

Expand Down

0 comments on commit 8449dec

Please sign in to comment.