3e7a261 Get non-existent Pungi4Release metadata from PDC if we can

Authored and Committed by adamwill 4 years ago
    Get non-existent Pungi4Release metadata from PDC if we can
    
    This was inspired by a discussion on devel@ this morning, where
    Kevin Fenzi was interested in tracking sizes of images over time.
    I've fiddled with this in fedfind before, so I wrote a sample
    script to show how easy it is, but noticed some ways we could
    do better. One is that we did not previously have any way to
    look up metadata from PDC for a compose that has been garbage
    collected, but was imported to PDC.
    
    Now, if you try to get a release by compose ID (and *only* then,
    this does not work when getting a release by URL or by old-style
    release/milestone/compose), and that compose isn't found in a
    mirror location but *is* in PDC, we will pull in the image
    metadata from PDC when instantiating. This is rather awkwardly
    shoehorned into the wrapper that was written to do a sanity
    check that the instance you got when getting a release by URL
    or compose ID actually has the URL or compose ID you specified;
    it's actually quite tricky to fit this path into the current
    design of fedfind, and this is the best way I could think of.
    
    If we get into that check and we're on the compose ID path and
    the instance we got does not seem to actually "have" a compose
    ID - which actually indicates that we can't find the compose
    files, as that's where we look up the compose ID - we set a
    special attribute temporarily and force the `metadata` property
    method to run, which (when that special attribute is set) will
    try and look the compose up in PDC, and stash the metadata if
    it's successful. The code for generating a properly-formatted
    metadata dict from the images data available from PDC is copied
    from `MirrorRelease.metadata` and simplified quite a lot as we
    don't have to worry about the path where we *don't* have PDC
    data, or the whole 'match actual image paths from this compose
    to the places where they were when the data was imported to
    PDC' thing that deals with the stupid process where we move
    some images around when publishing milestone releases.
    
    Ultimately the compose still doesn't really *exist* anywhere -
    you won't be able to find the images - but you can at least
    use the metadata for things like the size analysis we were
    talking about.
    
    Signed-off-by: Adam Williamson <awilliam@redhat.com>
    
        
file modified
+115 -4
file modified
+5 -2
file modified
+29 -0