Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding fallback support for pyyaml. #3383

Merged
merged 3 commits into from Feb 17, 2017

Conversation

kwoodson
Copy link
Contributor

No description provided.

@sdodson
Copy link
Member

sdodson commented Feb 16, 2017

aos-ci-test

@openshift-bot
Copy link

@ashcrow
Copy link
Member

ashcrow commented Feb 16, 2017

Reviewing now.

Copy link
Member

@ashcrow ashcrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one nit and one question. Overall it makes sense. Of course there are many ways to implement dual library usage but this should get the job done just fine.

try:
import ruamel.yaml as yaml # noqa: F401
except ImportError:
import yaml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

if hasattr(yaml, 'RoundTripLoader'):
self.yaml_dict = yaml.load(contents, yaml.RoundTripLoader)
else:
self.yaml_dict = yaml.load(contents)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: safe_load. Won't block on it though.

@@ -334,7 +334,11 @@ def write(self):
if hasattr(self.yaml_dict, 'fa'):
self.yaml_dict.fa.set_block_style()

Yedit._write(self.filename, yaml.dump(self.yaml_dict, Dumper=yaml.RoundTripDumper))
# pylint: disable=no-member
if hasattr(yaml, 'RoundTripDumper'):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently these modules all import ruamel.yaml directly and will always have yaml.RoundTripDumper. Will these be updated to try/except an ImportError like reqoquery?

@ashcrow
Copy link
Member

ashcrow commented Feb 16, 2017

aos-ci-test

@ashcrow
Copy link
Member

ashcrow commented Feb 16, 2017

@kwoodson 👍 to the changes. Assuming CI passes I say LGTM.

@openshift-bot
Copy link

@sdodson sdodson merged commit 43659a5 into openshift:master Feb 17, 2017
@chrrrles
Copy link

Thanks @kwoodson - @sdodson - Do you feel that the workaround in #3383 will be present in future versions of openshift-ansible?

@kwoodson kwoodson deleted the yedit_yaml_support branch March 10, 2017 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants