Skip to content

Commit

Permalink
13201 FIX <tt>omd cleanup</tt>: Skip default version
Browse files Browse the repository at this point in the history
The command <tt>omd cleanup</tt> used to also remove the default OMD
version if it was currently unused. This has been fixed.

Closes #391

Change-Id: I2ded46132080bead4a144d5ee74cb2d7bddbe692
  • Loading branch information
Amanda Hager Lopes de Andrade Katz authored and Joerg Herbel committed Sep 1, 2021
1 parent ba9de4c commit 6e5b971
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .werks/13201
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Title: <tt>omd cleanup</tt>: Skip default version
Class: fix
Compatible: compat
Component: omd
Date: 1630423479
Edition: cre
Knowledge: doc
Level: 1
State: unknown
Version: 2.0.0p10

The command <tt>omd cleanup</tt> used to also remove the default OMD
version if it was currently unused. This has been fixed.
9 changes: 9 additions & 0 deletions omd/packages/omd/omdlib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3057,6 +3057,15 @@ def main_cleanup(version_info: VersionInfo, site: SiteContext, global_opts: 'Glo
bail_out("Command is not supported on this platform")

for version in omd_versions():
if version == default_version():
sys.stdout.write(
"%s%-20s%s Keeping this version, since it is the default.\n" % (
tty.bold,
version,
tty.normal,
),)
continue

site_ids = [s for s in all_sites() if SiteContext(s).version == version]
if site_ids:
sys.stdout.write("%s%-20s%s In use (by %s). Keeping this version.\n" %
Expand Down

0 comments on commit 6e5b971

Please sign in to comment.