Use AuthRef for some client fields

This tackles some TODO items left over.

Change-Id: Ib062744acbf56f05d09857d244b78b35c0ef4d39
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2013-01-24 17:46:29 +01:00
parent 41c1c4d3a1
commit d7855cf8d9

View File

@ -18,7 +18,7 @@
import datetime
from keystoneclient.openstack.common import timeutils
from keystoneclient import service_catalog
# gap, in seconds, to determine whether the given token is about to expire
STALE_TOKEN_DURATION = 30
@ -28,6 +28,14 @@ class AccessInfo(dict):
"""An object for encapsulating a raw authentication token from keystone
and helper methods for extracting useful values from that token."""
def __init__(self, *args, **kwargs):
super(AccessInfo, self).__init__(*args, **kwargs)
self.service_catalog = service_catalog.ServiceCatalog(
resource_dict=self, region_name=self.get('region_name'))
def has_service_catalog(self):
return 'serviceCatalog' in self
def will_expire_soon(self, stale_duration=None):
""" Determines if expiration is about to occur.