r5563 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-05 18:02:58 +0000 (Wed, 05 Dec 2012)
New Revision: 5563
Modified:
trunk/cumin/python/cumin/objectselector.py
Log:
BZ 879257: cleaning-up searching of the Enqueued column by creating a custom sql filter.
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-12-04 17:37:21 UTC (rev 5562)
+++ trunk/cumin/python/cumin/objectselector.py 2012-12-05 18:02:58 UTC (rev 5563)
@@ -443,7 +443,7 @@
if sql_column.type.literal == "timestamp":
searchvalue = parse_date_from_string(customvalue)
- self.adapter.query.add_filter(self.SelectableFieldDateValueFilter(sql_column, searchvalue, operator))
+ self.adapter.query.add_filter(self.SelectableFieldDateEnqueuedValueFilter(sql_column, searchvalue, operator))
elif sql_column.type.literal == "int8" or sql_column.type.literal == "float8":
if sql_column.name in self.special_columns:
#adjust our search value to be an int based on the timestamp
@@ -540,6 +540,10 @@
class SelectableFieldDateValueFilter(SqlDateValueFilter, SelectableFieldFilter):
pass
+ class SelectableFieldDateEnqueuedValueFilter(SqlDateValueFilter, SelectableFieldFilter):
+ def emit(self):
+ return "date_trunc('second', %s) %s date_trunc('second', timestamp '%s')" % (self.this, self.operator, self.that)
+
class SelectableFieldUptimeValueFilter(SqlValueFilter, SelectableFieldFilter):
#necessary because we only show day:hour:minute to the user, but we store seconds in
#the cumin database. This filter takes the value from the user, and
11 years, 5 months
r5562 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-04 17:37:21 +0000 (Tue, 04 Dec 2012)
New Revision: 5562
Modified:
trunk/cumin/python/cumin/kerbauth.py
Log:
Adding stubbed find_user method.
Modified: trunk/cumin/python/cumin/kerbauth.py
===================================================================
--- trunk/cumin/python/cumin/kerbauth.py 2012-12-04 16:24:56 UTC (rev 5561)
+++ trunk/cumin/python/cumin/kerbauth.py 2012-12-04 17:37:21 UTC (rev 5562)
@@ -28,7 +28,10 @@
log.debug("Auth failed %s" % e)
else:
log.error("Kerberos authentication failed due to an invalid kerberos server/realm config")
- return isAuth
+ return isAuth
+
+ def find_user(self, username):
+ return False
@staticmethod
def isKerbAvail():
11 years, 5 months
r5561 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-04 16:24:56 +0000 (Tue, 04 Dec 2012)
New Revision: 5561
Modified:
trunk/cumin/python/cumin/objectselector.py
Log:
Fixing BZ 879330, Added new sqlfilter type to handle properly searching uptime values (which are stored as bigint seconds from epoch, but displayed and searched in dd:hh:mm). The new filter levels the playing field when searching against the database by truncating the seconds.
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-12-03 20:13:18 UTC (rev 5560)
+++ trunk/cumin/python/cumin/objectselector.py 2012-12-04 16:24:56 UTC (rev 5561)
@@ -446,8 +446,10 @@
self.adapter.query.add_filter(self.SelectableFieldDateValueFilter(sql_column, searchvalue, operator))
elif sql_column.type.literal == "int8" or sql_column.type.literal == "float8":
if sql_column.name in self.special_columns:
+ #adjust our search value to be an int based on the timestamp
customvalue = str(fmt_ddhhmm_timestamp(customvalue))
- if sql_column.type.literal == "int8" or sql_column.type.literal == "float8":
+ self.adapter.query.add_filter(self.SelectableFieldUptimeValueFilter(sql_column, operator))
+ if (sql_column.type.literal == "int8" or sql_column.type.literal == "float8") and sql_column.name not in self.special_columns:
if operator == ">=":
self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, ">="))
elif operator == ">":
@@ -536,7 +538,23 @@
pass
class SelectableFieldDateValueFilter(SqlDateValueFilter, SelectableFieldFilter):
- pass
+ pass
+
+ class SelectableFieldUptimeValueFilter(SqlValueFilter, SelectableFieldFilter):
+ #necessary because we only show day:hour:minute to the user, but we store seconds in
+ #the cumin database. This filter takes the value from the user, and
+ #searches it against the truncated value in the database
+ #This filter uses to_timestamp to go from the int to a timestamp, then
+ #does a date_trunc to remove anything after seconds, then does
+ #extract(epoch....) to get a value that can be fairly filtered against
+ #the user input.
+ def emit(self):
+ if self.gen_cursor and True in self.mogrify:
+ return self._mogrify()
+
+ return "extract(epoch from date_trunc('minute', to_timestamp(%s))) %s %s" % (self.this,
+ self.operator,
+ self.that)
class ObjectCheckboxColumn(ObjectTableColumn):
def __init__(self, app, name, attr, selection):
11 years, 5 months
r5560 - trunk/cumin/python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-03 20:13:18 +0000 (Mon, 03 Dec 2012)
New Revision: 5560
Modified:
trunk/cumin/python/cumin/objectselector.py
Log:
Fixing BZ 879314. Parsing of float inputs had been omitted from final assembly of filters.
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2012-12-03 19:54:58 UTC (rev 5559)
+++ trunk/cumin/python/cumin/objectselector.py 2012-12-03 20:13:18 UTC (rev 5560)
@@ -404,8 +404,14 @@
int(customvalue)
except:
self.error_in_query = True
- session.add_unique_notice(Notice("Error parsing valid integer from '%s', search results not updated" % xml_escape(customvalue), preamble=""))
-
+ session.add_unique_notice(Notice("Error parsing valid integer from '%s', search results not updated" % xml_escape(customvalue), preamble=""))
+
+ if sql_column.type.literal == "float8":
+ try:
+ float(customvalue)
+ except:
+ self.error_in_query = True
+ session.add_unique_notice(Notice("Error parsing valid float from '%s', search results not updated" % xml_escape(customvalue), preamble=""))
def get_data_values(self, session):
values = dict()
@@ -441,7 +447,7 @@
elif sql_column.type.literal == "int8" or sql_column.type.literal == "float8":
if sql_column.name in self.special_columns:
customvalue = str(fmt_ddhhmm_timestamp(customvalue))
- if sql_column.type.literal == "int8":
+ if sql_column.type.literal == "int8" or sql_column.type.literal == "float8":
if operator == ">=":
self.adapter.query.add_filter(self.SelectableFieldValueFilter(sql_column, ">="))
elif operator == ">":
11 years, 5 months
r5559 - trunk/wooly/python/wooly
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-03 19:54:58 +0000 (Mon, 03 Dec 2012)
New Revision: 5559
Modified:
trunk/wooly/python/wooly/util.py
Log:
Fixing BZ 879257. The utility function parse_date_from_string was suffering from a type-o causing all parsing attempts to fail.
Modified: trunk/wooly/python/wooly/util.py
===================================================================
--- trunk/wooly/python/wooly/util.py 2012-12-03 18:05:05 UTC (rev 5558)
+++ trunk/wooly/python/wooly/util.py 2012-12-03 19:54:58 UTC (rev 5559)
@@ -163,7 +163,7 @@
def parse_date_from_string(time_string):
if have_dateutil:
- return parser.parse(string)
+ return parser.parse(time_string)
else:
"""Return (<datetime.datetime() instance>) for the given datetime string."""
11 years, 5 months
r5558 - in trunk/cumin: bin etc python/cumin
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-03 18:05:05 +0000 (Mon, 03 Dec 2012)
New Revision: 5558
Modified:
trunk/cumin/bin/cumin-web
trunk/cumin/etc/cumin.conf
trunk/cumin/python/cumin/config.py
trunk/cumin/python/cumin/kerbauth.py
Log:
Additional tweaks for BZ 799129. No longer require kerberos_server since it is actually looked-up via the kerberos_realm (defined in krb5.conf). Also cleaned-up a log.debug statement that needed a % instead of a comma.
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2012-11-30 19:15:55 UTC (rev 5557)
+++ trunk/cumin/bin/cumin-web 2012-12-03 18:05:05 UTC (rev 5558)
@@ -71,7 +71,6 @@
cumin.ldap_tls_cacertfile = values.ldap_tls_cacertfile
def set_kerberos_configs(cumin, values):
- cumin.kerberos_server = values.kerberos_server
cumin.kerberos_realm = values.kerberos_realm
def check_cert_files(opts):
Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf 2012-11-30 19:15:55 UTC (rev 5557)
+++ trunk/cumin/etc/cumin.conf 2012-12-03 18:05:05 UTC (rev 5558)
@@ -104,7 +104,6 @@
# ldap_tls_cacertfile:
# ldap_tls_cacertdir:
# ldap_timeout: 30
-# kerberos_server:
# kerberos_realm:
#notification-timeout: 180
@@ -311,16 +310,12 @@
## ldap_timeout: 30
## Timeout in seconds for connections to an LDAP server
-## kerberos_server:
-## setting this [in addition to auth:kerb and kerberos_realm] will activate
-## kerberos authentication for cumin. The kerberos_server string should
-## be either the IP address or FQDN of the kerberos_server.
-
## kerberos_realm:
-## setting this [in addition to auth:kerb and kerberos_server] will activate
+## setting this [in addition to auth:kerb] will activate
## kerberos authentication for cumin. This should be set to the realm
## defined by your kerberos server. Typically, this value will be in all caps
-## and look like "EXAMPLE.COM"
+## and look like "EXAMPLE.COM". This value needs to be valid according to
+## your own krb5.conf file (where it is mapped to a kdc server).
## [data]
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2012-11-30 19:15:55 UTC (rev 5557)
+++ trunk/cumin/python/cumin/config.py 2012-12-03 18:05:05 UTC (rev 5558)
@@ -141,10 +141,7 @@
param = ConfigParameter(self, "ldap_timeout", int)
param.default = 30
-
- param = ConfigParameter(self, "kerberos_server", str)
- param.default = ""
-
+
param = ConfigParameter(self, "kerberos_realm", str)
param.default = ""
Modified: trunk/cumin/python/cumin/kerbauth.py
===================================================================
--- trunk/cumin/python/cumin/kerbauth.py 2012-11-30 19:15:55 UTC (rev 5557)
+++ trunk/cumin/python/cumin/kerbauth.py 2012-12-03 18:05:05 UTC (rev 5558)
@@ -11,21 +11,19 @@
class CuminAuthenticatorKerberos(object):
def __init__(self, mech, app):
log.info("Initializing %s", self)
- self.kerb_url = app.kerberos_server
self.kerb_realm = app.kerberos_realm
- if (self.kerb_url is not None and self.kerb_realm is not None
- and self.kerb_url is not "" and self.kerb_realm is not ""):
+ if (self.kerb_realm is not None and self.kerb_realm is not ""):
self.valid = True
else:
self.valid = False
log.info("Required values for kerberos_server and kerberos_realm not set")
def authenticate(self, username, password):
- log.debug("Authenticating for user %s against %s", (username, self.__class__.__name__))
+ log.debug("Authenticating for user %s against %s" % (username, self.__class__.__name__))
isAuth = False
if self.valid:
try:
- isAuth = kerberos.checkPassword(username, password, self.kerb_url, self.kerb_realm)
+ isAuth = kerberos.checkPassword(username, password, "HTTP", self.kerb_realm)
except Exception, e:
log.debug("Auth failed %s" % e)
else:
11 years, 5 months