fedmsg icon indicating copy to clipboard operation
fedmsg copied to clipboard

OS name, release and architecture to meta?

Open mbrysa opened this issue 10 years ago • 4 comments

Apparently, for the purposes of FAF, it's useful to further filter notifications by OS name (and while we're at it also release and architecture): https://github.com/abrt/faf/issues/432

Do you think it would make sense elsewhere as well? Would it warrant creating a os_releases method in meta.base.Base similar to packages and usernames, and a general filter in FMN? (E.g. filtering out EOL releases, focusing on rawhide, CentOS etc.)

Note that the message might have multiple OS names+releases associated with it.

mbrysa avatar May 11 '15 07:05 mbrysa

Sound good to me. I'd call it msg2releases(msg, **config), but what should the return value look like?

ralphbean avatar May 11 '15 12:05 ralphbean

I suggest a list of dicts:

[
    {
        "name": "Fedora",
        "release": "22",
        "arch": "x86_64",
    },
    {
        "name": "CentOS",
        "release": "7",
    },
]

where any of the fields is optional. This would nicely fit the FAF use case, but we should probably think about others as well :-)

mbrysa avatar May 11 '15 13:05 mbrysa

That works for me. I thought for a little bit about trying a dict of lists (instead of a list of dicts) and I think it might be nicer to use at first. Something like this:

{
    "Fedora": {
        "releases": ["22", "21"],
        "arches": ["x86_64"],
    },
    "CentOS": {
        "releases": ["7"],
    }
}

You could easily check that a message is about Fedora by writing:

if "Fedora" in msg2releases(msg, **config):
    print "Yes"

Whereas checking that a message is "about Fedora" with your proposed message format is a little more cumbersome:

if any([r.get("name") == "Fedora" for r in msg2releases(msg, **config)]):
    print "Yes"

.. but we lose some information with my format.

Say we have a FAF message that's about Fedora 22 x86_64 and Fedora 21 arm. The "easy to use" format I suggested above can't express that, but yours can... so, let's use yours. :)

ralphbean avatar May 11 '15 14:05 ralphbean

From Fedora infrastructure, I can also imagine these using it as publishers:

  • Build systems (COPR, Koji, Koschei, Jenkins?)
  • Package systems (Bodhi, pkgdb)
  • Bugzilla

As consumers:

  • Package systems (Bodhi, pkgdb)
  • Badges (e.g. builds on exotic archs)
  • FMN for filtering

Can you come up with something else?

I'd say the list of dicts approach should work reasonably well for all. A single dict could even be enough for all publishers except for FAF.

mbrysa avatar May 12 '15 07:05 mbrysa