Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
Size: Mime:
ó
|¥ýac@sËdZddlZddlZddlZddlZddlZddlZddlmZ	ddlm
Zddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZddlZdd
lmZddlZddlmZddlmZddl m!Z!ddl"m#Z#ddlm$Z$ddlm%Z%ddlm&Z&ddl'm(Z(ddl'm)Z)ddl'm*Z*ddl'm+Z+ddl'm,Z,ddl'm-Z-ddl.m/Z/ddlm0Z0ddl1m2Z2ddl1m3Z3ddl1m4Z4dd l1m5Z5dd!l6m7Z7dd"l6m8Z8dd#l6m9Z9dd$l6m:Z:ddl;Z<ddl=Z<dd%l>m?Z?ddl<m
Z
dd&l@mAZAdd'l<mBZBejCd(ƒZDe<jEjFZFejGeHƒZIe
jJƒZKe
jJƒZLd)„ZMdd*„ZOd+„ZPddeQd,„ZRdd-„ZSd.„ZTd/„ZUd0„ZVd1„ZWeWeTdd2„ƒƒZXdd3„ZYdd4„ZZd5„Z[d6„Z\d7„Z]d8„ZTe\d9„ƒZ^e]d:„ƒZ_e]d;„ƒZ`eTd<„ƒZae]dd=„ƒZbe]d>„ƒZce]d?„ƒZde]eQd@„ƒZee]eQdA„ƒZfe]dB„ƒZge]dC„ƒZheTdD„ƒZie\dE„ƒZje	jkdFdGdHelƒe\dI„ƒƒZmdS(Js%Implementation of SQLAlchemy backend.iÿÿÿÿN(tapi(t	exception(tenginefacade(tupdate_match(tutils(tlog(texcutils(timportutils(t	timeutils(t	uuidutils(trange(tand_(tBoolean(tNoSuchTableError(tcompiles(tInteger(tMetaData(tor_(taliased(tcontains_eager(t
joinedload(tjoinedload_all(tnoload(tundefer(tTable(tsql(tasc(tcast(tdesc(t
UpdateBase(tfalse(tfunc(tnull(ttrue(tmodels(t_(t
safe_utilssosprofiler.sqlalchemycCstjtS(s"The backend is this module itself.(tsystmodulest__name__(((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytget_backendEscCs5tt|jƒƒƒ}|dk	r1||d<n|S(Nt
connection(tdicttlisttitemstNone(t
conf_groupR)tkw((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyt_get_db_confIs
cCsYtjt|jƒtjt|jƒtrUtjd„ƒtjd„ƒndS(NcSstjt|dƒS(Ntdb(tprofiler_sqlalchemytadd_tracingtsa(teng((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyt<lambda>WscSstjt|dƒS(NR1(R2R3R4(R5((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyR6Ys(tmain_context_managert	configureR0tdatabasetapi_context_managertapi_databaseR2tappend_on_engine_create(tconf((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyR8Os
cCs|dkr|j}ni}d|kr7t|d<n>d|krPt|d<n%d|kr_nttdƒ|ƒ‚tj||j||}t	j
j|ƒrÿ|rÿ|dkrç|jt
|j|jk|jtƒkƒƒ}qÿ|jd|jƒ}n|S(	s9Query helper that accounts for context's `read_deleted` field.

    :param context:     ContegoserverContext of the query.
    :param model:       Model to query. Must be a subclass of ModelBase.
    :param args:        Arguments to query. If None - model is used.
    :param read_deleted: If not None, overrides context's read_deleted field.
                        Permitted values are 'no', which does not return
                        deleted values; 'only', which only returns deleted
                        values; and 'yes', which does not filter deleted
                        values.
    :param project_only: If set and context is user-type, then restrict
                        query to match the context's project_id. If set to
                        'allow_none', restriction includes project_id = None.
    tnotdeletedtonlytyess$Unrecognized read_deleted value '%s't
allow_nonet
project_idN(R-tread_deletedtFalsetTruet
ValueErrorR#tsqlalchemyutilstmodel_querytsessiontdmapitcontexttis_user_contexttfilterRRCR t	filter_by(RLtmodeltargsRDtproject_onlytquery_kwargstquery((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRI\s(


cCsìt|tjdtƒjtdƒƒjtdƒƒ}|dkrQddg}nxY|D]Q}|dkrpqXnd|kr”|jt|ƒƒ}qX|jt|ƒƒ}qXWx8ddgD]*}||krº|jt	|ƒƒ}qºqºW|S(	NRRssecurity_groups.rulest
info_cachetmetadatatsystem_metadatatsecurity_groupssextra.(RURX(
RIR"tInstanceRFtoptionsRRR-RR(RLtcolumns_to_joinRTtcolumntcol((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyt_build_instance_gets
cs"tjˆƒ‡fd†ƒ}|S(sÅDecorator to use a reader.allow_async db context manager.

    The db context manager will be picked from the RequestContext.

    Wrapped function must have a RequestContext in the arguments.
    cs<t|ƒ}|jjj|ƒˆ|||ŽSWdQXdS(N(tget_context_managertreadertallow_asynctusing(RLRQtkwargstctxt_mgr(tf(s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytwrapped©s(t	functoolstwraps(ReRf((Res;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyt'pick_context_manager_reader_allow_async¢scCst|ƒptS(swGet a database context manager object.

    :param context: The request context that can contain a context manager
    (t_context_manager_from_contextR7(RL((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyR_°scCs,|r(y|jSWq(tk
r$q(XndS(N(t
db_connectiontAttributeError(RL((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRj¶s

cs"tjˆƒ‡fd†ƒ}|S(sEDecorator to require *any* user or admin context.

    This does no authorization for user or project access matching, see
    :py:func:`Contegoserver.context.authorize_project_context` and
    :py:func:`Contegoserver.context.authorize_user_context`.

    The first argument to the wrapped function must be the context.

    cs!tjj|dƒˆ||ŽS(Ni(RKRLtrequire_context(RQRc(Re(s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytwrapperÈs(RgRh(ReRn((Res;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRm½scCst||d|ƒS(NR[(t_instance_get_by_uuid(RLtuuidR[((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytinstance_get_by_uuidÎscCsCt|d|ƒjd|ƒjƒ}|s?tjd|ƒ‚n|S(NR[Rptinstance_id(R^ROtfirstRtInstanceNotFound(RLRpR[tresult((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRoÕs
cCs,tjƒ}|jttjd|ƒ|S(sfCreate a database context manager object.

    : param connection: The database connection string
    R)(Rttransaction_contextR8R0tCONFR9(R)Rd((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytcreate_context_manageràscs"tjˆƒ‡fd†ƒ}|S(sZDecorator to select synchronous or asynchronous reader mode.
    The kwarg argument 'use_slave' defines reader mode. Asynchronous reader
    will be used if 'use_slave' is True and synchronous reader otherwise.
    If 'use_slave' is not specified default value 'False' will be used.
    Wrapped function must have a context in the arguments.
    csŽtjˆƒ}tj|||Ž}|d}|jdtƒ}|rXt|ƒj}nt|ƒj}|j	|ƒˆ||ŽSWdQXdS(NRLt	use_slave(
R$tget_wrapped_functiontinspecttgetcallargstgetRER_tasync_R`Rb(RQRctwrapped_funct
keyed_argsRLRytreader_mode(Re(s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRnòs
(RgRh(ReRn((Res;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytselect_db_reader_modeêscs"tjˆƒ‡fd†ƒ}|S(s·Decorator to use a writer db context manager.
    The db context manager will be picked from the RequestContext.
    Wrapped function must have a RequestContext in the arguments.
    cs9t|ƒ}|jj|ƒˆ|||ŽSWdQXdS(N(R_twriterRb(RLRQRcRd(Re(s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRf	s(RgRh(ReRf((Res;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytpick_context_manager_writerscs"tjˆƒ‡fd†ƒ}|S(s·Decorator to use a reader db context manager.
    The db context manager will be picked from the RequestContext.
    Wrapped function must have a RequestContext in the arguments.
    cs9t|ƒ}|jj|ƒˆ|||ŽSWdQXdS(N(R_R`Rb(RLRQRcRd(Re(s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRfs(RgRh(ReRf((Res;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytpick_context_manager_readerscs"tjˆƒ‡fd†ƒ}|S(sÃDecorator to use a reader.allow_async db context manager.
    The db context manager will be picked from the RequestContext.
    Wrapped function must have a RequestContext in the arguments.
    cs<t|ƒ}|jjj|ƒˆ|||ŽSWdQXdS(N(R_R`RaRb(RLRQRcRd(Re(s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRf#s(RgRh(ReRf((Res;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyRiscCs—t||ƒ}t|tjƒjd|ƒjdtƒ|jdkr“t|tjƒj	t
tjj|ktjj|dkƒƒjdtƒndS(Ntidtsynchronize_sessionstvault-contegothost(
tservice_getRIR"tServiceROtsoft_deleteREtbinarytComputeNodeRNRt
service_idRˆ(RLRŽtservice((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_destroy.scCsIt|tjƒjd|ƒ}|jƒ}|sEtjd|ƒ‚n|S(NR†RŽ(RIR"RŠRORsRtServiceNotFound(RLRŽRTRu((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyR‰=s
cCsIt|tjƒjd|ƒ}|jƒ}|sEtjd|ƒ‚n|S(NRpRŽ(RIR"RŠRORsRR‘(RLtservice_uuidRTRu((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_by_uuidHs
cCsˆ|jjtjjtjtjjƒƒjtjjj	|ƒƒjtjj
dkƒjtjjtƒkƒj
tjjƒ}t|ƒS(Ni(RJRTR"RŠRŒRtmintversionRNtin_R?tforced_downRtgroup_byR*(RLtbinariestmin_versions((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_minimum_versionSs		cCs=t|tjƒ}|dk	r3|jd|ƒ}n|jƒS(Ntdisabled(RIR"RŠR-ROtall(RLRœRT((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_all_scCs4t|tjddƒjdtƒjd|ƒjƒS(NRDR>Rœttopic(RIR"RŠRORER(RLRŸ((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_all_by_topiciscCs@t|tjddƒjdtƒjd|ƒjd|ƒjƒS(NRDR>RœRˆRŸ(RIR"RŠRORERs(RLRˆRŸ((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_by_host_and_topicqscCsCt|tjƒjd|ƒ}|s9|jdtƒ}n|jƒS(NRŒRœ(RIR"RŠRORER(RLRŒtinclude_disabledRT((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_all_by_binaryzscCsŽt|tjddƒjddƒ}|s?|jdtƒ}n|jtjtjjtjjkƒjtjj	|kƒj
dƒ}|jƒS(NRDR>RŒstvault-contegoRœRˆ(RIR"RŠROREtjoinRRˆRNthypervisor_typetdistinctR(RLthv_typeR¢RT((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyt#service_get_all_computes_by_hv_type‚s		cCs[t|tjddƒjd|ƒjd|ƒjƒ}|sWtjd|d|ƒ‚n|S(NRDR>RˆRŒ(RIR"RŠRORsRtHostBinaryNotFound(RLRˆRŒRu((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_by_host_and_binaryscCs(t|tjddƒjd|ƒjƒS(NRDR>Rˆ(RIR"RŠROR(RLRˆ((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_all_by_hostscCsUt|tjddƒjd|ƒjddƒjƒ}|sQtjd|ƒ‚n|S(NRDR>RˆRŒstvault-contego(RIR"RŠRORsRtComputeHostNotFound(RLRˆRu((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_get_by_compute_host¤scCs°tjƒ}|j|ƒy|j|jƒWn|tjk
r«}d|jkr~tj	d|j
dƒd|j
dƒƒ‚ntjd|j
dƒd|j
dƒƒ‚nX|S(NRŒRˆRŸ(R"RŠtupdatetsaveRJtdb_exctDBDuplicateEntrytcolumnsRtServiceBinaryExistsR}tServiceTopicExists(RLtvaluestservice_refte((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_create±s
tmax_retriesitretry_on_deadlockcCsTt||ƒ}d|krC|d|jkrCtjƒ|_qCn|j|ƒ|S(Ntreport_count(R‰R»Rtutcnowtlast_seen_upR®(RLRŽRµR¶((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pytservice_updateÀs
(nt__doc__tcollectionstcopytdatetimeRgR{R%toslo_dbRtoslo_db_apiRR°toslo_db.sqlalchemyRRRRHtoslo_logRtloggingt
oslo_utilsRRRR	tsixt	six.movesR
t
sqlalchemyR4RRtsqlalchemy.excR
tsqlalchemy.ext.compilerRRRRtsqlalchemy.ormRRRRRRtsqlalchemy.schemaRRtsqlalchemy.sql.expressionRRRRtsqlalchemy.sqlRRR R!t
dmapi.confRKt
dmapi.contexttdmapi.db.sqlalchemyR"t
dmapi.i18nR#R$t
try_importR2R=Rwt	getLoggerR'tLOGRvR7R:R(R-R0R8RERIR^RiR_RjRmRqRoRxR‚R„R…RR‰R“R›RžR R¡R£R¨RªR«R­R¸t
wrap_db_retryRFR¾(((s;/usr/lib/python2.7/dist-packages/dmapi/db/sqlalchemy/api.pyt<module>s¶		.