mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #23146 from rallytime/bp-20779
Backport #20779 to 2014.7
This commit is contained in:
commit
3b53e04534
2 changed files with 4 additions and 2 deletions
|
@ -17,6 +17,7 @@ from yaml.constructor import ConstructorError
|
|||
from yaml.scanner import ScannerError
|
||||
|
||||
from salt.utils.serializers import DeserializationError, SerializationError
|
||||
from salt.utils.odict import OrderedDict
|
||||
|
||||
__all__ = ['deserialize', 'serialize', 'available']
|
||||
|
||||
|
@ -63,7 +64,7 @@ def serialize(obj, **options):
|
|||
:param options: options given to lower yaml module.
|
||||
"""
|
||||
|
||||
options.setdefault('Dumper', BaseDumper)
|
||||
options.setdefault('Dumper', Dumper)
|
||||
try:
|
||||
response = yaml.dump(obj, **options)
|
||||
if response.endswith('\n...\n'):
|
||||
|
@ -112,3 +113,4 @@ Dumper.add_multi_representer(set, Dumper.represent_set)
|
|||
Dumper.add_multi_representer(datetime.date, Dumper.represent_date)
|
||||
Dumper.add_multi_representer(datetime.datetime, Dumper.represent_datetime)
|
||||
Dumper.add_multi_representer(None, Dumper.represent_undefined)
|
||||
Dumper.add_multi_representer(OrderedDict, Dumper.represent_dict)
|
||||
|
|
|
@ -128,7 +128,7 @@ class TestSerializers(TestCase):
|
|||
assert obj == final_obj
|
||||
|
||||
# BLAAM! yml_src is not valid !
|
||||
final_obj = yaml.deserialize(yml_src)
|
||||
final_obj = OrderedDict(yaml.deserialize(yml_src))
|
||||
assert obj != final_obj
|
||||
|
||||
@skipIf(not yamlex.available, SKIP_MESSAGE % 'sls')
|
||||
|
|
Loading…
Add table
Reference in a new issue