Merge lp:~hloeung/ubuntu-repository-cache/logging-ubuntu_active-plus-keeps into lp:ubuntu-repository-cache

Proposed by Haw Loeung on 2021-01-08
Status: Merged
Approved by: Colin Misare on 2021-01-08
Approved revision: 298
Merged at revision: 296
Proposed branch: lp:~hloeung/ubuntu-repository-cache/logging-ubuntu_active-plus-keeps
Merge into: lp:ubuntu-repository-cache
Diff against target: 27 lines (+9/-1)
1 file modified
lib/ubuntu_repository_cache/metadata_sync.py (+9/-1)
To merge this branch: bzr merge lp:~hloeung/ubuntu-repository-cache/logging-ubuntu_active-plus-keeps
Reviewer Review Type Date Requested Status
Colin Misare 2021-01-08 Approve on 2021-01-08
Canonical IS Reviewers 2021-01-08 Pending
Review via email: mp+395966@code.launchpad.net

Commit message

Check and ensure metadata to be removed isn't ubuntu_active - LP:1799595

Also log what ubuntu_active points at and the list of directories to keep, if provided.

To post a comment you must log in.

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

298. By Haw Loeung on 2021-01-08

Double check and ensure it isn't what ubuntu_active points at - LP:1799595

Colin Misare (cmisare) wrote :

Seems good to me

review: Approve

Change successfully merged at revision 296

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/ubuntu_repository_cache/metadata_sync.py'
--- lib/ubuntu_repository_cache/metadata_sync.py 2020-10-13 04:08:14 +0000
+++ lib/ubuntu_repository_cache/metadata_sync.py 2021-01-08 04:19:31 +0000
@@ -329,6 +329,9 @@
329 active = os.path.realpath('/'.join((apache_data, 'ubuntu_active')))329 active = os.path.realpath('/'.join((apache_data, 'ubuntu_active')))
330 canary = '_'.join((active, 'good'))330 canary = '_'.join((active, 'good'))
331 keep = set((active, canary))331 keep = set((active, canary))
332 log('ubuntu_active currently points at: {}'.format(active))
333 else:
334 log('Keeping list provided: {}'.format(', '.join(keep)))
332335
333 glob_path = '/'.join((apache_data, '/ubuntu_[0-9]*'))336 glob_path = '/'.join((apache_data, '/ubuntu_[0-9]*'))
334337
@@ -345,7 +348,12 @@
345348
346 for entry in [os.path.realpath(p) for p in glob.glob(glob_path)]:349 for entry in [os.path.realpath(p) for p in glob.glob(glob_path)]:
347 if entry not in keep:350 if entry not in keep:
348 if os.path.isfile(entry):351 # We want to make sure it isn't the directory
352 # ubuntu_active points to (LP#1799595).
353 active = os.path.realpath('/'.join((apache_data, 'ubuntu_active')))
354 if entry == active:
355 log('ubuntu_active points to {}, skipping'.format(entry))
356 elif os.path.isfile(entry):
349 # XXX: Should be a debug357 # XXX: Should be a debug
350 log('Removing file {}'.format(entry))358 log('Removing file {}'.format(entry))
351 os.remove(entry)359 os.remove(entry)

Subscribers

People subscribed via source and target branches