backend/server/configFilesHandler.py | 31 +++++++++++++------------------
1 file changed, 13 insertions(+), 18 deletions(-)
New commits:
commit c32b6136b3790c1e310b1a697b6d3a306083e136
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 7 16:21:18 2011 +0100
removed dead (commented out) code
diff --git a/backend/server/configFilesHandler.py b/backend/server/configFilesHandler.py
index 16cb6ac..29d5b24 100644
--- a/backend/server/configFilesHandler.py
+++ b/backend/server/configFilesHandler.py
@@ -375,8 +375,6 @@ class ConfigFilesHandler(rhnHandler):
return
# Have to insert this config file, gotta use the api to keep quotas up2date...
- #h = rhnSQL.prepare(self._query_insert_config_file)
- #apply(h.execute, (), file)
insert_call = rhnSQL.Function("rhn_config.insert_file",
rhnSQL.types.NUMBER())
file['config_file_id'] = insert_call(file['config_channel_id'], file['path'])
commit e688feb56abd397626c5d6fbbf9d7d2db2f3df83
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 7 16:19:35 2011 +0100
removed deprecated apply() function
diff --git a/backend/server/configFilesHandler.py b/backend/server/configFilesHandler.py
index 5f8a9f6..16cb6ac 100644
--- a/backend/server/configFilesHandler.py
+++ b/backend/server/configFilesHandler.py
@@ -38,7 +38,7 @@ import rhnSession
# Exceptions
class BaseConfigFileError(Exception):
def __init__(self, args):
- apply(Exception.__init__, (self, ) + args)
+ Exception.__init__(self, *args)
class ConfigFileError(BaseConfigFileError):
def __init__(self, file, *args):
@@ -187,7 +187,7 @@ class ConfigFilesHandler(rhnHandler):
if not file['selinux_ctx']:
# RHEL4 or RHEL5+ with disabled selinux - set from the last revision
h = rhnSQL.prepare(self._query_current_selinux_lookup)
- apply(h.execute, (), file)
+ h.execute(**file)
row = h.fetchone_dict()
if row:
file['selinux_ctx'] = row['selinux_ctx']
@@ -310,7 +310,7 @@ class ConfigFilesHandler(rhnHandler):
h = rhnSQL.prepare(self._query_content_lookup)
- apply(h.execute, (), file)
+ h.execute(**file)
row = h.fetchone_dict()
if row:
@@ -355,7 +355,7 @@ class ConfigFilesHandler(rhnHandler):
# Look up the config info first
h = rhnSQL.prepare(config_info_query)
- apply(h.execute, (), file)
+ h.execute(**file)
row = h.fetchone_dict()
if not row:
# Hmm
@@ -365,7 +365,7 @@ class ConfigFilesHandler(rhnHandler):
# Look up the config file itself
h = rhnSQL.prepare(self._query_lookup_config_file)
- apply(h.execute, (), file)
+ h.execute(**file)
row = h.fetchone_dict()
if row:
# Yay we already have this file
@@ -393,7 +393,7 @@ class ConfigFilesHandler(rhnHandler):
# Assume we don't have any revision for now
file['revision'] = 1
h = rhnSQL.prepare(self._query_lookup_revision)
- apply(h.execute, (), file)
+ h.execute(**file)
row = h.fetchone_dict()
if row:
# Is it the same revision as this one?
@@ -436,7 +436,7 @@ class ConfigFilesHandler(rhnHandler):
def _update_revision(self, file):
h = rhnSQL.prepare(self._query_update_revision)
- apply(h.execute, (), file)
+ h.execute(**file)
def _insert_revision(self, file):
@@ -469,7 +469,7 @@ class ConfigFilesHandler(rhnHandler):
def _update_config_file(self, file):
h = rhnSQL.prepare(self._query_update_config_file)
- apply(h.execute, (), file)
+ h.execute(**file)
def _format_file_results(self, row):
server = None
commit 447475269def57f0cbd0073d02ca5c167079e67c
Author: Michael Mraka <michael.mraka(a)redhat.com>
Date: Wed Dec 7 15:56:41 2011 +0100
760892 - set selinux=None if selinux is disabled
diff --git a/backend/server/configFilesHandler.py b/backend/server/configFilesHandler.py
index f393a1d..5f8a9f6 100644
--- a/backend/server/configFilesHandler.py
+++ b/backend/server/configFilesHandler.py
@@ -180,11 +180,11 @@ class ConfigFilesHandler(rhnHandler):
file['username'] = file.get('user','')
file['groupname'] = file.get('group','')
file['file_mode'] = file.get('mode','')
- # if the selinux flag is not sent by the client it is set to the last file revision
- # (or to the empty string in case of first revision) - see the bug
+ # if the selinux flag is not sent by the client it is set to the last file
+ # revision (or to None (i.e. NULL) in case of first revision) - see the bug
# 644985 - SELinux context cleared from RHEL4 rhncfg-client
- selinux_ctx_or_none = file.get('selinux_ctx', None)
- if selinux_ctx_or_none is None:
+ file['selinux_ctx'] = file.get('selinux_ctx', None)
+ if not file['selinux_ctx']:
# RHEL4 or RHEL5+ with disabled selinux - set from the last revision
h = rhnSQL.prepare(self._query_current_selinux_lookup)
apply(h.execute, (), file)
@@ -192,10 +192,7 @@ class ConfigFilesHandler(rhnHandler):
if row:
file['selinux_ctx'] = row['selinux_ctx']
else:
- file['selinux_ctx'] = ''
- else:
- # RHEL5+ with enabled selinux - set from the incoming request
- file['selinux_ctx'] = selinux_ctx_or_none
+ file['selinux_ctx'] = None
result = {}
try: