Module: check_mk
Branch: master
Commit: 3584c594cac74802badb472d6db20094c5ba5892
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3584c594cac748…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Sep 10 15:48:59 2012 +0200
FIX: Remove also user settings and event console rule on factory reset
---
ChangeLog | 1 +
web/htdocs/wato.py | 10 ++++++++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 40b9e07..9dff937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -74,6 +74,7 @@
* FIX: Removed double collect_hosts() call in activate changes hook
* FIX: Fixed double hook execution when using localized multisite
* FIX: User list shows names of contactgroups when no alias given
+ * FIX: Remove also user settings and event console rule on factory reset
BI:
* Great speed up of rule compilation in large environments
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e078419..8d3cbc2 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -5135,14 +5135,20 @@ def factory_reset():
for id in users.keys():
if id != config.user_id:
del users[id]
- save_users(users) # this will cleanup htpasswd
- for path in [ root_dir, multisite_dir, sites_mk, log_dir ]:
+ to_delete = [ path for c,n,path
+ in backup_paths
+ if n != "auth.secret" ] + [ log_dir ]
+ for path in to_delete:
if os.path.isdir(path):
shutil.rmtree(path)
elif os.path.exists(path):
os.remove(path)
+ make_nagios_directory(multisite_dir)
+ make_nagios_directory(root_dir)
+
+ save_users(users) # make sure, omdadmin is present after this
log_pending(SYNCRESTART, None, "factory-reset", _("Complete reset to
factory settings."))