#2950 kojira: Do not ever clean up repositories where 'latest' points to
Merged 2 years ago by tkopecek. Opened 2 years ago by ignatenkobrain.
ignatenkobrain/koji dist-clean  into  master

file modified
+13 -2
@@ -661,9 +661,17 @@ 

              if not os.path.isdir(tagdir):

                  self.logger.debug("%s is not a directory, skipping", tagdir)

                  continue

+ 

+             # Remember where latest symlink points to (if exists)

+             repo_latest_path = "%s/latest" % tagdir

+             repo_latest_id = (

+                 os.readlink(repo_latest_path)

+                 if os.path.isdir(repo_latest_path)

+                 else None

+             )

              for repo_id in os.listdir(tagdir):

-                 if repo_id == 'latest':

-                     # ignore latest symlinks

+                 if repo_id == 'latest' or repo_id == repo_latest_id:

+                     # ignore latest symlinks or repo where one points to

                      continue

                  try:

                      repo_id = int(repo_id)
@@ -931,6 +939,9 @@ 

              if tag_id not in build_tags and tag_id not in ignored_build_tags:

                  # repos for these tags are no longer required

                  for repo in repolist:

+                     if repo.dist:

+                         # Dist repos should expire only basd on the time

+                         continue

                      if repo.ready():

                          repo.expire()

  

We don't want to leave symlink broken… Ideally we would find out stuff
where we should even remove "latest" but it is not straightforward and I
believe this simple check is good enough for the time being.

Fixes: https://pagure.io/koji/issue/2832
Signed-off-by: Igor Raits igor.raits@gmail.com

Just flake8 is failin on too-long line. Otherwise :thumbsup:

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto 611c132b3659710401b234f26b6fd970339c308b

2 years ago

Metadata Update from @tkopecek:
- Pull-request untagged with: testing-ready

2 years ago

Hmm, found some problems with this. If that tag is "build" or "ignored" tag it will work. Otherwise there is other part of code which will delete it in another thread. It makes sense to me to skip distrepos there. They should expire only based on time.

:monkey_face:

@tkopecek let me add there some if

rebased onto 4f59d31

2 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

Nothing :-) It is waiting for QE recheck and then I'll merge it. Will be part of next release (1.26).

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

2 years ago

Commit 6ec2a17 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago
Metadata