/usr/lib/python2.6/site-packages/keystoneauth1
NameSizeModeActions
access/-0755rm
exceptions/-0755rm
extras/-0755rm
fixture/-0755rm
hacking/-0755rm
identity/-0755rm
loading/-0755rm
tests/-0755rm
adapter.py82660644editdlrm
adapter.pyc89020644editdlrm
discover.py123720644editdlrm
discover.pyc120440644editdlrm
plugin.py78220644editdlrm
plugin.pyc83050644editdlrm
session.py305020644editdlrm
session.pyc263890644editdlrm
token_endpoint.py13630644editdlrm
token_endpoint.pyc14490644editdlrm
_utils.py71270644editdlrm
_utils.pyc80590644editdlrm
__init__.py00644editdlrm
__init__.pyc1480644editdlrm
Edit: /usr/lib/python2.6/site-packages/keystoneauth1/discover.pyc (12044B)
Ñò DVc@sÒdZddkZddklZddklZeieƒZei ƒdd„ƒZ d„Z d„Z defd „ƒYZd efd „ƒYZeƒZeid eid ƒdƒd„Zd„ZdS(sÖThe passive components to version discovery. The Discover object in discover.py contains functions that can create objects on your behalf. These functions are not usable from within the keystoneauth1 library because you will get dependency resolution issues. The Discover object in this file provides the querying components of Discovery. This includes functions like url_for which allow you to retrieve URLs and the raw data specified in version discovery responses. iÿÿÿÿN(t_utils(t exceptionscCs hdd6}|i|d|d|ƒ}y|iƒ}Wntj onuXy|ddSWnttfj onXy |dSWntj onXy|dgSWntj onXt|iƒdjo|id d n|i}tid |ƒ‚d S( s%Retrieve raw version data from a url.sapplication/jsontAccepttheaderst authenticatedtversionstvaluestversioni2s...s0Invalid Response - Bad version data returned: %sN( tgettjsont ValueErrortKeyErrort TypeErrortlenttextRtDiscoveryFailure(tsessionturlRRtrespt body_respterr_text((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytget_version_data!s*  1 cCsÒy|idƒ}Wntj onXyt|ƒ}Wntj onXt|ƒ}y ttt|idƒƒƒSWntj onXyttt|ƒƒSWntj onXt d|ƒ‚dS(s+Turn a version representation into a tuple.tvt.sInvalid version specified: %sN( tlstriptAttributeErrortfloatt ExceptiontstrttupletmaptinttsplitR (Rtnum((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytnormalize_version_numberGs$  cCs0|d|djotS||jotStS(s×Test that an available version is a suitable match for a required version. To be suitable a version must be of the same major version as required and be at least a match in minor/patch level. eg. 3.3 is a match for a required 3.1 but 4.1 is not. :param tuple required: the version that must be met. :param tuple candidate: the version to test against required. :returns: True if candidate is suitable False otherwise. :rtype: bool i(tFalsetTrue(trequiredt candidate((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyt version_matchhs  tDiscovercBs_eZd Zd Zd Zeiƒd d„ƒZe e e d„Z d„Z d„Z d „ZRS(tstabletcurrentt supportedt deprecatedt experimentalcCst||d|ƒ|_dS(NR(Rt_data(tselfRRR((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyt__init__‰s cCsïg}xâ|iD]×}y|d}Wn#tj otidƒqnX|iƒ}||ijo|i|ƒq||ijo|o|i|ƒqçq||ijo|o|i|ƒqçq|o|i|ƒqqW|S(s_Get raw version information from URL. Raw data indicates that only minimal validation processing is performed on the data, so what is returned here will be the data in the same format it was received from the endpoint. :param bool allow_experimental: Allow experimental version endpoints. :param bool allow_deprecated: Allow deprecated version endpoints. :param bool allow_unknown: Allow endpoints with an unrecognised status. :returns: The endpoints returned from the server that match the criteria. :rtype: list tstatussCSkipping over invalid version data. No stability status in version.( R.R t_LOGGERtwarningtlowertCURRENT_STATUSEStappendtDEPRECATED_STATUSEStEXPERIMENTAL_STATUSES(R/tallow_experimentaltallow_deprecatedt allow_unknownRRR1((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytraw_version_dataŽs(   c KsT|i|}g}x%|D]}y|d}Wn#tj otidƒqnXy|d}Wn#tj otidƒqnXt|ƒ}xz|D]b}y|d} |d} Wn)ttfj otidƒqnX| iƒdjoPqqWtid ƒq|ih|d 6| d 6|d d 6ƒqW|idd„ƒ|S(sçGet normalized version data. Return version data in a structured way. :returns: A list of version data dictionaries sorted by version number. Each data element in the returned list is a dictionary consisting of at least: :version tuple: The normalized version of the endpoint. :url str: The url for the endpoint. :raw_status str: The status as provided by the server :rtype: list(dict) tids*Skipping invalid version data. Missing ID.tlinkss,Skipping invalid version data. Missing linkstrelthrefs@Skipping invalid version link. Missing link URL or relationship.R/s8Skipping invalid version data. Missing link to endpoint.RRR1t raw_statustkeycSs|dS(R((R((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytês( R<R R2tinfoR"R R4R6tsort( R/tkwargstdataRRt version_strR>tversion_numbertlinkR?R((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyt version_data¶s@       cKsOt|ƒ}|i|}x-t|ƒD]}t||dƒo|Sq(WdS(sÌReturn endpoint data for a version. :param tuple version: The version is always a minimum version in the same major release as there should be no compatibility issues with using a version newer than the one asked for. :returns: the endpoint data for a URL that matches the required version (the format is described in version_data) or None if no match. :rtype: dict RN(R"RKtreversedR'tNone(R/RRFRKRG((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytdata_forís   cKs&|i||}|o |dSdS(saGet the endpoint url for a version. :param tuple version: The version is always a minimum version in the same major release as there should be no compatibility issues with using a version newer than the one asked for. :returns: The url for the specified version or None if no match. :rtype: str RN(RNRM(R/RRFRG((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyturl_fors (R)scurrents supported(R,(R-N(t__name__t __module__R5R7R8tutilst positionalRMR0R#R$R<RKRNRO(((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyR(ƒs ' 7 t _VersionHackscBs,eZdZd„Zdd„Zd„ZRS(s¢A container to abstract the list of version hacks. This could be done as simply a dictionary but is abstracted like this to make for easier testing. cCs h|_dS(N(t_discovery_data(R/((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyR0stcCs,|ii|gƒ}|i||fƒdS(sßAdd a new hack for a service type. :param str service_type: The service_type in the catalog. :param re.RegexObject old: The pattern to use. :param str new: What to replace the pattern with. N(RUt setdefaultR6(R/t service_typetoldtnewthacks((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytadd_discover_hackscCsTxM|ii|gƒD]6\}}|i||ƒ\}}|djo|SqW|S(s6Apply the catalog hacks and figure out an unversioned endpoint. :param str service_type: the service_type to look up. :param str url: The original url that came from a service_catalog. :returns: Either the unversioned url or the one from the catalog to try. i(RURtsubn(R/RXRRYRZt new_stringtnumber_of_subs_made((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytget_discover_hack$s    (RPRQt__doc__R0R\R`(((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyRTs  tidentitys/v2.0/?$t/cCsti||ƒS(sEApply the catalog hacks and figure out an unversioned endpoint. This function is internal to keystoneauth1. :param str service_type: the service_type to look up. :param str url: The original url that came from a service_catalog. :returns: Either the unversioned url or the one from the catalog to try. (t_VERSION_HACKSR`(RXR((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyt_get_catalog_discover_hack9s cCsti|||ƒdS(sOAdds a version removal rule for a particular service. Originally deployments of OpenStack would contain a versioned endpoint in the catalog for different services. E.g. an identity service might look like ``http://localhost:5000/v2.0``. This is a problem when we want to use a different version like v3.0 as there is no way to tell where it is located. We cannot simply change all service catalogs either so there must be a way to handle the older style of catalog. This function adds a rule for a given service type that if part of the URL matches a given regular expression in *old* then it will be replaced with the *new* value. This will replace all instances of old with new. It should therefore contain a regex anchor. For example the included rule states:: add_catalog_version_hack('identity', re.compile('/v2.0/?$'), '/') so if the catalog retrieves an *identity* URL that ends with /v2.0 or /v2.0/ then it should replace it simply with / to fix the user's catalog. :param str service_type: The service type as defined in the catalog that the rule will apply to. :param re.RegexObject old: The regular expression to search for and replace if found. :param str new: The new string to replace the pattern with. N(RdR\(RXRYRZ((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pytadd_catalog_discover_hackFs(Ratret keystoneauth1RRRRt get_loggerRPR2RSRMRR"R'tobjectR(RTRdR\tcompileReRf(((s=/tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/discover.pyts  % ! %