The YAML 1.2 spec was released in 2009. It's probably been enough time
that it's safe to move to it.
The only issue for out YAML usage was 1.2 dropped the use of Yes, No, On,
and Off as valid boolean values.
Change-Id: I608e09d219379e00cca15c5ff165bb63aecfe9f2
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
The Ruamel library has better support for modifying YAML while keeping
things like comments. This updates our yamlutil module to use
ruamel.yaml instead of PyYAML.
Story: 2002908
Task: 22880
Change-Id: I4ac66c9e3e40780b588377c1dfe42511eed231a3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
That was a constant paper cut for me: every time someone uses
edit-deliverables it may result in release highlights being
reformatted to create lines over 80 char. You can see that
happening at:
https://review.openstack.org/#/c/650911/1/deliverables/rocky/cloudkitty.yaml
where it messes up perfectly-good yaml and turns it into 88-char-long
lines.
I experimented with various settings (you would think width=80 would
do, but no). Forcing dump width at 66 characters seems to produce the
desired results.
Change-Id: I83934a0f7d6eeaec47b5dcb1a6bfb8c53ed65799
We want the canonical data files to have repeated information to make
it easy for human readers to understand the content, so do not emit
aliases to blocks of repeated data.
Change-Id: Ib6bf3f3683fae2edb94910bea86971e591b5b87c
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
The default is to use true/false but most of our data is already yes/no.
Change-Id: I9b6573e8e5a7c4acd0d33a9cf0790b58d4e60662
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
Update the reformatter to always put quotes around strings that look
like they are numbers. A value like x.y.z is clearly not a float so
the library does the right thing but x.y seems like a float so it
leaves the quotes off, then later when we parse the file again we get
a number not a string.
Change-Id: I6126f59d09d169a2dde1cdffcecd15f8c65c2e65
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
1.As mentioned in [1], we should avoid using
six.iteritems to achieve iterators. We can
use dict.items instead, as it will return
iterators in PY3 as well. And dict.items/keys
will more readable. 2.In py2, the performance
about list should be negligible, see the link [2].
[1] https://wiki.openstack.org/wiki/Python3
[2] http://lists.openstack.org/pipermail/openstack-dev/2015-June/066391.html
Change-Id: I83997d0c43826c9d5b06a72d93365e8e9b4587af
When a string is found (and about to be output) that
already has newlines in it (say it was read in previously)
we shouldn't be trying to reformat that string when
writing it back out; so avoid doing this by searching for
existing newlines and not re-wrapping things when they
already exist.
Change-Id: Ic310677314172f46b360c90197539993eb5bcc99
Do note this will lose comments, if pyyaml ever supports
not losing those then this can avoid losing those.
Change-Id: I4b26362f7cab42eb40804751c86d9145490c78d9