#5 Don't use `-` characters in metadata values
Opened 8 years ago by adamwill. Modified 8 years ago

So I'm looking at https://pagure.io/pungi-fedora/blob/master/f/fedora.conf#_270 :

            'format': [('qcow2','qcow2'), ('raw-xz','raw.xz')]

I'm guessing the value 'raw-xz' is what would show up in the metadata as the format of that image.

However, in other metadata fields - e.g. the arch, x86_64, and I think some variants, e.g. Cloud_Atomic - we use _ to separate words inside values.

Having some fields use _ as an internal separator and others use - as an internal separator is going to be very messy; people tend to join values with one character or the other, but if both characters are used within values, splitting them back out again becomes impossible or messy.

The naming policy explicitly covers this and forbids the use of - within values:

"Fields may only contain ASCII alphanumeric characters and underscores. Particularly of note, the character '-' is reserved for use as a field separator. No field may itself contain that character."

I know that technically the naming policy only covers the image filename and volume ID and the format would be raw.xz in the filename and is not included in the volume ID, so this isn't technically breaking that policy, but it's obviously in the same ballpark.

So, can we please change raw-xz to raw_xz and generally make it a rule that the metadata values don't use -? Thanks!

(I see also distro and name fields that use -, but I'm not sure either of those actually winds up in the output metadata, which is what I care about).


For reference, the practical case I have here is that for openQA purposes I need to create a flavor, which is something like "the server boot iso" or "the cloud atomic qcow disk image". The logical way to do this is to combine a few Pungi metadata values; right now I'm using variant plus type plus format (format seems to be necessary to distinguish, say, 'cloud base qcow2' from 'cloud base img' or whatever).

If variant can be Cloud_Atomic and format can be raw-xz, what character am I supposed to use to join the values such that I can reliably split them up again later (which I also need to do)?

raw-xz is what we have to pass to koji we can not change it.

https://kojipkgs.fedoraproject.org/compose/rawhide/Fedora-24-20160217.n.1/compose/metadata/images.json has all the cloud images in it

Well, I think "can not" is too strong. After all, it's already a tuple in fedora.conf:

https://pagure.io/pungi-fedora/blob/master/f/fedora.conf#_277

so I don't see why it couldn't be a 3-tuple (value passed to koji, value used in filename, value stored in metadata). That would be possible, right? But you don't want to. ;)

(OK, maybe it would need changes in some other component, but still, all things are possible...)

This would also require a change in productmd, as it validates the value against a list here.

Login to comment on this ticket.

Metadata