Module: check_mk
Branch: master
Commit: 38fb4741bd6bf9396c47f13134b5e449be0f6113
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=38fb4741bd6bf9…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jul 27 14:58:40 2015 +0200
#2487 Remove dangerous <i>Factory Reset</i> button
We removed the button <i>Factory Reset</i> completely from WATO. This button
is dangerous. Also it does anyway just a reset of WATO - not of other data
in the site like NagVis maps etc. For a real reset better remove and recreate
the site with:
C+:
RP:omd stop mysite
RP:omd rm mysite
RP:omd create mysite
C-:
---
.werks/2487 | 18 ++++++++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 48 ++++--------------------------------------------
3 files changed, 23 insertions(+), 44 deletions(-)
diff --git a/.werks/2487 b/.werks/2487
new file mode 100644
index 0000000..84c4e2b
--- /dev/null
+++ b/.werks/2487
@@ -0,0 +1,18 @@
+Title: Remove dangerous <i>Factory Reset</i> button
+Level: 2
+Component: wato
+Compatible: compat
+Version: 1.2.7i3
+Date: 1438001809
+Class: feature
+
+We removed the button <i>Factory Reset</i> completely from WATO. This button
+is dangerous. Also it does anyway just a reset of WATO - not of other data
+in the site like NagVis maps etc. For a real reset better remove and recreate
+the site with:
+
+C+:
+RP:omd stop mysite
+RP:omd rm mysite
+RP:omd create mysite
+C-:
diff --git a/ChangeLog b/ChangeLog
index d3ec1b7..29c311d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -111,6 +111,7 @@
* 2463 Hiding not permitted actions from service discovery page when only permitted
on host...
* 2479 Allowing dots in host-, service- and contact groups now
* 2486 Remove special handling for non-distributed-setups in WATO...
+ * 2487 Remove dangerous <i>Factory Reset</i> button...
* 2344 FIX: Improved validation of selected rules when editing BI aggregations...
* 2346 FIX: Notifications: Fixed garbled page when switching on/off
bulks/backlog/user rules
* 2372 FIX: Avoid freezing WATO during bulk discovery if hosts do not respond in a
timely manner
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index d8c9380..a5689e1 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -199,10 +199,9 @@ def page_handler():
lock_exclusive()
try:
- # Make information about current folder and hosts available
- # To be able to perform a "factory reset" or a snapshot restore
- # even with a broken config ignore exceptions in this function
- # when running in "snapshot" mode
+ # Make information about current folder and hosts available To be able
+ # to restore a snapshot even with a broken config ignore exceptions
+ # in this function when running in "snapshot" mode
prepare_folder_info()
except:
if current_mode == 'snapshot':
@@ -6797,8 +6796,6 @@ def mode_snapshot(phase):
elif phase == "buttons":
home_button()
changelog_button()
- html.context_button(_("Factory Reset"),
- make_action_link([("mode",
"snapshot"),("_factory_reset","Yes")]),
"factoryreset")
return
# Cleanup incompletely processed snapshot upload
@@ -6983,18 +6980,6 @@ def mode_snapshot(phase):
elif c == False: # not yet confirmed
return ""
- elif html.has_var("_factory_reset"):
- c = wato_confirm(_("Confirm factory reset"),
- _("If you proceed now, all hosts, folders, rules and other
configurations "
- "done with WATO will be deleted! Please consider making a snapshot
before "
- "you do this. Snapshots will not be deleted. Also the password of
the currently "
- "logged in user (%s) will be kept.<br><br>"
- "Do you really want to delete all or your configuration
data?") % config.user_id)
- if c:
- factory_reset()
- return None, _("Resetted WATO, wiped all configuration.")
- elif c == False: # not yet confirmed
- return ""
return None
else:
@@ -7100,30 +7085,6 @@ def create_snapshot(data = {}):
return snapshot_name
-def factory_reset():
- # Darn. What makes things complicated here is that we need to conserve htpasswd,
- # at least the account of the currently logged in user.
- users = userdb.load_users(lock = True)
- for id in users.keys():
- if id != config.user_id:
- del users[id]
-
- 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)
-
- userdb.save_users(users) # make sure, omdadmin is present after this
- log_pending(SYNCRESTART, None, "factory-reset", _("Complete reset to
factory settings."))
-
-
#.
# .--Value-Editor--------------------------------------------------------.
# | __ __ _ _____ _ _ _ |
@@ -19892,8 +19853,7 @@ def load_plugins():
_("Backup & Restore"),
_("Access to the module <i>Backup & Restore</i>. Please
note: a user with "
"write access to this module "
- "can make arbitrary changes to the configuration by restoring uploaded
snapshots "
- "and even do a complete factory reset!"),
+ "can make arbitrary changes to the configuration by restoring uploaded
snapshots."),
[ "admin", ])
config.declare_permission("wato.pattern_editor",