Module: check_mk
Branch: master
Commit: 11bfb5115ac9e443000a8b3b38aa24d536547669
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=11bfb5115ac9e4…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Dec 17 15:49:37 2015 +0100
New automation for releasing packages
---
modules/automation.py | 11 ++++++++---
modules/packaging.py | 2 +-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/modules/automation.py b/modules/automation.py
index dad86be..4cca757 100644
--- a/modules/automation.py
+++ b/modules/automation.py
@@ -55,7 +55,9 @@ def do_automation(cmd, args):
elif cmd == "install-package":
result = automation_install_package(args)
elif cmd == "remove-package":
- result = automation_remove_package(args)
+ result = automation_remove_or_release_package(args, "remove")
+ elif cmd == "release-package":
+ result = automation_remove_or_release_package(args, "release")
elif cmd == "notification-get-bulks":
result = automation_get_bulks(args)
else:
@@ -1349,10 +1351,13 @@ def automation_install_package(args):
raise MKAutomationError("Cannot install package: %s" % e)
-def automation_remove_package(args):
+def automation_remove_or_release_package(args, mode):
load_module("packaging")
package_name = args[0]
package = read_package_info(package_name)
if not package:
raise MKAutomationError("Package not installed or corrupt")
- remove_package(package)
+ if mode == "remove":
+ remove_package(package)
+ else:
+ remove_package_info(package_name)
diff --git a/modules/packaging.py b/modules/packaging.py
index 1e4ec3c..6f6f962 100644
--- a/modules/packaging.py
+++ b/modules/packaging.py
@@ -248,7 +248,6 @@ def package_release(args):
if package_exists(pacname):
raise PackageException("No such package %s." % pacname)
package = read_package_info(pacname)
- os.unlink(pacpath)
verbose("Releasing files of package %s into freedom...\n" % pacname)
if opt_verbose:
for part, title, perm, dir in package_parts:
@@ -257,6 +256,7 @@ def package_release(args):
verbose(" %s%s%s:\n" % (tty_bold, title, tty_normal))
for f in filenames:
verbose(" %s\n" % f)
+ remove_package_info(pacname)
def package_exists(pacname):