On 07/30/2012 11:30 AM, Stephen Ingram wrote:
On Wed, Jul 25, 2012 at 11:18 PM, Stephen Ingram <sbing...@gmail.com> wrote:
On Wed, Jul 25, 2012 at 4:31 AM, John Dennis <jden...@redhat.com> wrote:
On 07/25/2012 02:59 AM, Stephen Ingram wrote:
Seeing python2.7, I'm guessing these patches were against Fedora.
Since I couldn't get them to apply against RH 6.3 I applied them by
hand. I couldn't get the WebUI to load after applying the patches. I'm
not sure of the code that caused the problem, but I did see mention of
global name datetime not being defined. You wouldn't happen to have
patches for RH 6.3?
Sorry, I thought you had a F17 install. It should be easy to fix the
datetime issue, just add this add the top of the file:
import time, datetime
If that simple fix doesn't work then let me know the version you've got and
I'll make up a new patch against that version.
Yes, please send a patch for 2.20 with RH 6.3. The import time,
datetime did not address all of the errors.
Not sure if you missed this one or not, but, yes, I do need a patch
for 2.20 on RH 6.3. I added datetime, but there were still other
errors that I couldn't resolve.
Sorry, I did see it but I was busy with other things. You can try the
attached patch. However you need to have a clean set of files to patch
against. The patch command I suggested included the -b option and would
have created backup files of the original file with a .orig suffix.
These are the files the patch touches.
ipalib/session.py
ipaserver/plugins/ldap2.py
ipaserver/rpcserver.py
Find their .orig version and cp it back to the original filename. Then
you can try applying the patch again.
Caveat: I did not test this against 2.20, I just manually made the same
set of changes and generated a patch, it's possible in my hurry I made a
mistake you may need to tweak,
--
John Dennis <jden...@redhat.com>
Looking to carve out IT costs?
www.redhat.com/carveoutcosts/
diff --git a/ipalib/session.py b/ipalib/session.py
index 4b783bb..8eb9105 100644
--- a/ipalib/session.py
+++ b/ipalib/session.py
@@ -23,6 +23,7 @@ import errors
import os
import re
import time
+import datetime
from text import _
from ipapython.ipa_log_manager import *
from ipalib import api, errors
@@ -628,9 +629,9 @@ mod_auth_kerb. Everything else remains the same.
default_max_session_duration = 60*60 # number of seconds
-ISO8601_DATETIME_FMT = '%Y-%m-%dT%H:%M:%S' # FIXME jrd, this should be defined elsewhere
+ISO8601_DATETIME_FMT = '%Y-%m-%dT%H:%M:%S.%f' # FIXME jrd, this should be defined elsewhere
def fmt_time(timestamp):
- return time.strftime(ISO8601_DATETIME_FMT, time.localtime(timestamp))
+ return datetime.fromtimestamp(timestamp).strftime(ISO8601_DATETIME_FMT)
#-------------------------------------------------------------------------------
diff --git a/ipaserver/plugins/ldap2.py b/ipaserver/plugins/ldap2.py
index ddef8df..2d7447d 100644
--- a/ipaserver/plugins/ldap2.py
+++ b/ipaserver/plugins/ldap2.py
@@ -733,6 +733,7 @@ class ldap2(CrudBackend, Encoder):
attrs_list = list(set(attrs_list))
# pass arguments to python-ldap
+ start_time = time.time()
try:
id = self.conn.search_ext(
base_dn, scope, filter, attrs_list, timeout=time_limit,
@@ -751,6 +752,9 @@ class ldap2(CrudBackend, Encoder):
except _ldap.LDAPError, e:
_handle_errors(e)
+ end_time = time.time()
+ root_logger.debug('ldap2 find_entries: elapsed_time=%f', end_time-start_time)
+
if not res and not truncated:
raise errors.NotFound(reason='no such entry')
@@ -1381,4 +1385,3 @@ class ldap2(CrudBackend, Encoder):
return (len(output), output)
api.register(ldap2)
-
diff --git a/ipaserver/rpcserver.py b/ipaserver/rpcserver.py
index 83c5c2d..ffee3c6 100644
--- a/ipaserver/rpcserver.py
+++ b/ipaserver/rpcserver.py
@@ -293,6 +293,7 @@ class WSGIExecutioner(Executioner):
args = ()
options = {}
+ start_time = time.time()
if not 'HTTP_REFERER' in environ:
return self.marshal(result, RefererError(referer='missing'), _id)
if not environ['HTTP_REFERER'].startswith('https://%s/ipa' % self.api.env.host) and not self.env.in_tree:
@@ -337,10 +338,11 @@ class WSGIExecutioner(Executioner):
# get at least some context of what is going on
params = options
principal = getattr(context, 'principal', 'UNKNOWN')
+ end_time = time.time()
if error:
self.info('%s: %s(%s): %s', principal, name, ', '.join(self.Command[name]._repr_iter(**params)), e.__class__.__name__)
else:
- self.info('%s: %s(%s): SUCCESS', principal, name, ', '.join(self.Command[name]._repr_iter(**params)))
+ self.info('%s: %s(%s): SUCCESS elapsed_time=%f', principal, name, ', '.join(self.Command[name]._repr_iter(**params)), end_time-start_time)
else:
self.info('%s: %s', context.principal, e.__class__.__name__)
return self.marshal(result, error, _id)
@@ -775,6 +777,7 @@ class jsonserver_session(jsonserver, KerberosSession):
'''
'''
+ start_time = time.time()
self.debug('WSGI jsonserver_session.__call__:')
# Load the session data
@@ -836,6 +839,8 @@ class jsonserver_session(jsonserver, KerberosSession):
session_mgr.store_session_data(session_data)
destroy_context()
+ end_time = time.time()
+ self.debug('WSGI jsonserver_session.__call__: elapsed_time=%f', end_time-start_time)
return response
class jsonserver_kerb(jsonserver):
@@ -991,4 +996,3 @@ class login_password(Backend, KerberosSession, HTTP_Status):
if returncode != 0:
raise InvalidSessionPassword(principal=principal, message=unicode(stderr))
-
_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel