Yep that looks about right. Go ahead and send a pull request and I'll test it out.

On Thu, Aug 15, 2013 at 12:22 PM, Orion Poplawski <orion@cora.nwra.com> wrote:
On 08/15/2013 09:55 AM, James Cammarata wrote:
The CobblerXMLRPCInterface class is instantiated with an api object, which has
access to the settings. So what would be required is:
>
1) add the setting to settings.py (and a default value in the config/settings
file)
2) modify remote.py to use self.api.settings().the_new_var_name instead of
TOKEN_TIMEOUT.


How does this seem?

diff --git a/cobbler/remote.py b/cobbler/remote.py
index dded424..042c311 100644
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -49,8 +49,6 @@ import utils
 from utils import _
 import configgen

-# FIXME: make configurable?
-TOKEN_TIMEOUT = 60*60 # 60 minutes
 EVENT_TIMEOUT = 7*24*60*60 # 1 week
 CACHE_TIMEOUT = 10*60 # 10 minutes

@@ -1710,7 +1708,7 @@ class CobblerXMLRPCInterface:
         timenow = time.time()
         for token in self.token_cache.keys():
             (tokentime, user) = self.token_cache[token]
-            if (timenow > tokentime + TOKEN_TIMEOUT):
+            if (timenow > tokentime + self.api.settings().auth_token_expiration):
                 self._log("expiring token",token=token,debug=True)
                 del self.token_cache[token]
         # and also expired objects
diff --git a/cobbler/settings.py b/cobbler/settings.py
index ba5c953..393018c 100644
--- a/cobbler/settings.py
+++ b/cobbler/settings.py
@@ -39,6 +39,7 @@ DEFAULTS = {
     "allow_duplicate_macs"                : [0,"bool"],
     "allow_duplicate_ips"                 : [0,"bool"],
     "allow_dynamic_settings"              : [0,"bool"],
+    "auth_token_expiration"               : [3600,"int"],
     "bind_chroot_path"                    : ["","str"],
     "bind_master"                         : ["127.0.0.1","str"],
     "build_reporting_enabled"             : [0,"bool"],
diff --git a/config/settings b/config/settings
index 9f04362..d5d4a12 100644
--- a/config/settings
+++ b/config/settings
@@ -39,6 +39,9 @@ anamon_enabled: 0
 # The default value is "login".
 authn_pam_service: "login"

+# How long the authentication token is valid for, in seconds
+auth_token_expiration: 3600
+
 # Email out a report when cobbler finishes installing a system.
 # enabled: set to 1 to turn this feature on
 # sender: optional


I can make a pull request if this seems reasonable.

Removing the other hard-coded _TIMEOUT settings would be nice too (though no
one ever complains about those).


Yeah, I was wondering about that.


--
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@nwra.com
Boulder, CO 80301                   http://www.nwra.com
_______________________________________________
cobbler mailing list
cobbler@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/cobbler