Merge "Use AuthRef for some client fields"

This commit is contained in:
Jenkins 2013-06-15 21:41:23 +00:00 committed by Gerrit Code Review
commit 8c18672504

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.