kojira: check repo.json before deleting
Fixes: https://pagure.io/koji/issue/1321
This commit is contained in:
parent
267f5bbae0
commit
1a76030707
1 changed files with 12 additions and 3 deletions
15
util/kojira
15
util/kojira
|
|
@ -675,9 +675,18 @@ class RepoManager(object):
|
|||
self.rmtree(repodir)
|
||||
continue
|
||||
if rinfo['tag_name'] != tag:
|
||||
self.logger.warning(
|
||||
"Tag name mismatch (rename?): %s vs %s", tag, rinfo['tag_name'])
|
||||
continue
|
||||
try:
|
||||
# possible rename of tag, repo.json should exist and contain tag id
|
||||
repo_json = koji.load_json(os.path.join(repodir, 'repo.json'))
|
||||
if rinfo['tag_id'] != repo_json['tag_id']:
|
||||
self.logger.warning(
|
||||
"Tag name/id mismatch: directory: %s, name: %s, id: %s",
|
||||
tag, rinfo['tag_name'], repo_json['tag_id'])
|
||||
continue
|
||||
except Exception:
|
||||
self.logger.warning(
|
||||
"Tag name mismatch (rename?): %s vs %s", tag, rinfo['tag_name'])
|
||||
continue
|
||||
if rinfo['state'] in (koji.REPO_DELETED, koji.REPO_PROBLEM):
|
||||
age = time.time() - max(rinfo['create_ts'], dir_ts)
|
||||
self.logger.debug("potential removal candidate: %s; age: %s" % (repodir, age))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue