Delete DockerMetaTags when docker tags are deleted
DockerMetaTags are not getting deleted when docker tags are.
Deletion of docker tags only results in the nullification.
What we need to happen is some thing along
check if schema1 meta tag does Not have a schema2 entry and if so delete it.
check if schema2 meta tag does Not have a schema1 entry and if so delete it.
To see a good example try the following in a rails or foreman-rake console
>> dmt = ::Katello::DockerMetaTag.first >> dmt.schema1.try(:destroy) ; dmt.schema2.try(:destroy) >> dmt = ::Katello::DockerMetaTag.find(dmt.id) # reload #Actual <Katello::DockerMetaTag id: 4978, schema1_id: 5753, schema2_id: nil, name: "1.24.2-glibc", repository_id: 3> #Expected #ActiveRecord::RecordNotFound: Couldn't find Katello::DockerMetaTag with 'id'=4978 #This operation should fail because deleting the associated docker tags should wipe out the meta tag
Fixes #21326 - DockerTag deletion cleansup MetaTag
This commit addresses the issue of stale MetaTag if docker tag got
deleted. Prior to this commit if one deleted a docker tag, the code
would only nullify the appropriate schema column in the docker meta
What we need to happen is that the DockerMetaTag entries need to get
wiped out if both schema1 and schema2 columns are nil. This commit
addresses that issue.