Skip to content

Commit

Permalink
Fixed yaml.RepresenterError during 'connection save' command
Browse files Browse the repository at this point in the history
This added a dependency to the yamlloader package.

Signed-off-by: Andreas Maier <andreas.r.maier@gmx.de>
  • Loading branch information
andy-maier committed May 29, 2020
1 parent 99e8be4 commit fb0c97d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ Released: not yet

* Fixed incorrect connection list output in readme files (see issue #593).

* Fixed yaml.RepresenterError during 'connection save' command. This introduced
a dependency on the yamlloader package. (see issue #603).

**Enhancements:**

* Enabled installation using 'setup.py install' from unpacked source distribution
Expand Down
1 change: 1 addition & 0 deletions minimum-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ prompt-toolkit==1.0.15; python_version == '2.7'
prompt-toolkit==2.0.1; python_version >= '3.4'
PyYAML==5.1
pydicti==1.1.3
yamlloader==0.5.5

# Virtualenv
virtualenv==14.0.0; python_version < '3.5'
Expand Down
12 changes: 7 additions & 5 deletions pywbemtools/pywbemcli/_connection_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

import os
import yaml
import yamlloader
import six

from ._pywbem_server import PywbemServer
Expand Down Expand Up @@ -258,11 +259,12 @@ def _write_file(self): # pylint: disable=no-self-use
tmpfile = '{}.tmp'.format(self._connections_file)

with self.open_file(tmpfile, 'w') as _fp:
data = yaml.safe_dump(yaml_dict,
encoding=None,
allow_unicode=True,
default_flow_style=False,
indent=4)
data = yaml.dump(yaml_dict,
encoding=None,
allow_unicode=True,
default_flow_style=False,
indent=4,
Dumper=yamlloader.ordereddict.CSafeDumper)
data = data.replace('\n\n', '\n') # YAML dump dups newlines
_fp.write(data)
_fp.flush()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ pydicti>=1.1.3
PyYAML>=5.1; python_version == '2.7'
PyYAML>=5.1,<5.3; python_version == '3.4'
PyYAML>=5.1; python_version > '3.4'
yamlloader>=0.5.5

0 comments on commit fb0c97d

Please sign in to comment.