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

ruyaml usage; Removing needed quotes #248

Open
martinhoyer opened this issue Jun 22, 2023 · 5 comments
Open

ruyaml usage; Removing needed quotes #248

martinhoyer opened this issue Jun 22, 2023 · 5 comments
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed

Comments

@martinhoyer
Copy link
Contributor

Question

Hi,
looking at ruyaml repo, it looks like there is not much development happening for past couple of years. Do you plan to keep using it in this project?

Might not be related to the parser, but I've hit for example this issue:

ISCSI_INITIATORNAME: iqn.1994-05.com.redhat:test
ISCSI_IFACES: [{iscsi_ifacename: 'qedi.00:00:00:00:00:00', setup: {ipaddress: 172.16.0.86}, targets: [{portal: 172.16.0.10}]},
  {iscsi_ifacename: 'qedi.00:00:00:00:00:01', setup: {ipaddress: 172.16.1.86}, targets: [{portal: 172.16.1.10}]}]

yamlfix will re-format the file to:

ISCSI_INITIATORNAME: iqn.1994-05.com.redhat:test
ISCSI_IFACES:
  - {iscsi_ifacename: qedi.00:00:00:00:00:00, setup: {ipaddress: 172.16.0.86}, targets: [portal: 172.16.0.10]}
  - {iscsi_ifacename: qedi.00:00:00:00:00:01, setup: {ipaddress: 172.16.1.86}, targets: [portal: 172.16.1.10]}

..which unfortunately removes the strings from the mac-address-like string.
When I then want to use the yaml file in program relying on ruamel.yaml:

ruamel.yaml.scanner.ScannerError: while scanning a plain scalar
  in "<unicode string>", line 3, column 23
found unexpected ':'
  in "<unicode string>", line 3, column 30

Running yamlfmt adds the quotes back.

@martinhoyer martinhoyer added the question Further information is requested label Jun 22, 2023
@lyz-code
Copy link
Owner

Hey @martinhoyer, thanks for taking the time to open an issue. We use ruyaml because it was a fork maintained by the community, if it's not maintained anymore we can think of migrating to a new yaml parser, do you know anyone that is active?

Regarding your issue at hand I see two solutions:

  • Report the bug upstream (which we know won't probably get any attention soon)
  • Fix it here

If you go for the second, I think it would be nice if you could add the link on the upstream bug report so that once its fixed we can remove that piece of code

@lyz-code lyz-code added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers and removed question Further information is requested labels Jun 26, 2023
@martinhoyer
Copy link
Contributor Author

Hey @lyz-code, thanks for the reply!

last time I checked there wasn't really any 'golden bullet' for yaml parsing in Python. Ruyaml being drop-in replacement to ruamel.yaml, maybe the switch to ruamel.yaml, which is being maintained (from what I can tell) and is released under MIT license could be relatively pain-less?

@lyz-code
Copy link
Owner

I lived the whole migration from ruamel.yaml to ruyaml, and one of the reasons was that the first one is maintained by a benevolent dictator. I hate those kind of projects, and prefer the community maintained ones. I'm not saying no to migrating back, but there must be real benefits (like this issue being solved or other ones with the upstream blocked value) before I'd like to have such a dependency.

@martinhoyer
Copy link
Contributor Author

100% understandable. I've also encountered some issues with ruamel.yaml.
There is also StrictYAML - what are your thoughts on using that?

@lyz-code
Copy link
Owner

I don't know the project so I can't give a based judgment. I've skimmed through their docs and it looks ok, but until we do a deep analysis of the pros and cos we won't know for sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants