Module: check_mk
Branch: master
Commit: 5b6697d03140d29135b26ee3a6f8a83d4bcdb28a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5b6697d03140d2…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Feb 16 14:44:37 2018 +0100
Dropped create_user_file()
Change-Id: I1f54ee3fafb9d9ed9b1d8eaa63e44128fa95dbc8
---
web/htdocs/key_mgmt.py | 6 +-----
web/htdocs/lib.py | 8 --------
web/htdocs/watolib.py | 3 ++-
3 files changed, 3 insertions(+), 14 deletions(-)
diff --git a/web/htdocs/key_mgmt.py b/web/htdocs/key_mgmt.py
index c8d8e7b..be3ab60 100644
--- a/web/htdocs/key_mgmt.py
+++ b/web/htdocs/key_mgmt.py
@@ -38,7 +38,6 @@ import cmk.store as store
import table
import config
from valuespec import *
-from lib import create_user_file
from gui_exceptions import MKUserError
@@ -61,10 +60,7 @@ class KeypairStore(object):
def save(self, keys):
store.mkdir(os.path.dirname(self._path))
- # TODO: Recode to store. functions. But this is also used in appliance code, do
we have cma system wide available?
- out = create_user_file(self._path, "w")
- out.write("# Written by WATO\n# encoding: utf-8\n\n")
- out.write("%s.update(%s)\n\n" % (self._attr, pprint.pformat(keys)))
+ store.save_mk_file(self._path, "%s.update(%s)" % (self._attr,
pprint.pformat(keys)))
def choices(self):
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 23b865f..139858e 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -33,14 +33,6 @@ import cmk.paths
from log import logger
-# TODO: Deprecate this function! Don't use this anymore. Use the store.* functions!
-def create_user_file(path, mode):
- path = make_utf8(path)
- f = file(path, mode, 0)
- os.chmod(path, 0660)
- return f
-
-
# TODO: Remove this helper function. Replace with explicit checks and covnersion
# in using code.
def savefloat(f):
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index ca2d995..46d677a 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -214,7 +214,8 @@ def log_entry(linkinfo, action, message, user_id=None):
user_id = user_id.encode("utf-8")
store.mkdir(os.path.dirname(audit_log_path))
- with create_user_file(audit_log_path, "ab") as f:
+ with open(audit_log_path, "ab") as f:
+ os.chmod(f.name, 0660)
f.write("%d %s %s %s %s\n" % (int(time.time()), link, user_id,
action, message.replace("\n",
"\\n")))