-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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
INI: values with spaces can be single or double quoted #77369
Conversation
Ideally the page should enumerate all characters whose presence requires the value to be quoted (I'm guessing that includes quotes and possibly backslashes?). Also: maybe you can also escape whitespace with a backslash, not just quote it?
Thanks for your Ansible docs contribution! We talk about Ansible documentation on maxtrix at #docs:ansible.im and on libera IRC at #ansible-docs if you ever want to join us and chat about the docs! We meet there on Tuesdays (see the Ansible calendar) and welcome additions to our weekly agenda items - scroll down to find the upcoming agenda and add a comment to put something new on that agenda. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's just sufficient to say that the value can be quoted. I don't think we should call out both single and double quotes. If we want, we can link to documentation for https://docs.python.org/3/library/shlex.html#parsing-rules We operate in POSIX mode. However, I don't think we should try to duplicate the info from the python docs into our docs. Which is why I think just saying "The value can be quoted" is sufficient. |
That's a good idea, a link should definitely be included.
I agree it's not necessary to duplicate the Python documentation, but I think it's useful to explicitly state what kinds of quotes will work. As a user, if I were reading that document and it just said "can be quoted" I would be annoyed because it didn't say how and I would need to find out by experimenting. "Single or double" isn't excessively wordy, isn't likely to change, and doesn't duplicate too much of the Python documentation. |
Hi @akorn - can you add the link and POSIX note to this PR? As for whether to have just 'quoted' vs 'single or double quoted'... I would lean toward @sivel's comment that saying quoted is enough. There is only single or double quoted options, right? But if you feel strongly that it helps the user to state it explicitly, I'm fine with that as well. Thanks! |
I also reduced the wordiness ("single quoted or double quoted" -> "quoted (single or double)"
Yes, there are only these two options, but either both work or only one of them works. I think adding three words to point out that both work is better than leaving the user guessing, or having to find out by trial and error, or having to check the shlex documentation. I made it "quoted (single or double)", and added the shlex parsing rules link (correctly, I hope -- I'm not terribly good with rst). |
Thanks @akorn for the Ansible docs fix! |
(cherry picked from commit ac56647)
Ideally the page should enumerate all characters whose presence requires the value to be quoted (I'm guessing that includes quotes and possibly backslashes?).
Also: maybe you can also escape whitespace with a backslash, not just quote it?
SUMMARY
The page said "When declared inline with the host, INI values are interpreted as Python literal structures (strings, numbers, tuples, lists, dicts, booleans, None). Host lines accept multiple key=value parameters per line. Therefore they need a way to indicate that a space is part of a value rather than a separator." but failed to say what that way was. I added quoting as one possible way.
ISSUE TYPE
COMPONENT NAME
inventory(?)
ADDITIONAL INFORMATION
None