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    
dmapi / usr / lib / python2.7 / dist-packages / dmapi / cmd / policy.pyc
Size: Mime:
ó
À_c@sádZddlmZddlZddlZddlZddlmZddlm	Z
ddlZddlm
Z
ddlmZddlmZdd	lmZdd
lmZddlmZddlmZejjZejd
dddejjdƒdedƒƒejddddejjdƒdedƒƒejddddejjdƒdedƒƒgZdefd„ƒYZied6Zej e
j!deƒZ!ej"d d!d"dd#d$e!ƒZ#d%„Z$dS(&s0
  CLI interface for nova policy rule commands.
iÿÿÿÿ(tprint_functionN(tcfg(tcommon(tconfig(tcontext(tdb(t	exception(t_(tpolicies(tversionsos-rolestmetavars<auth-roles>tdefaulttOS_ROLESthelpsDefaults to env[OS_ROLES].s
os-user-ids<auth-user-id>t
OS_USER_IDsDefaults to env[OS_USER_ID].sos-tenant-ids<auth-tenant-id>tOS_TENANT_IDsDefaults to env[OS_TENANT_ID].tPolicyCommandsc
Bs¢eZdZdddddgZejdddd	d
ddƒejd
ddddd	ddddjeƒƒddd„ƒƒZd„Z	d„Z
d„ZRS(sCommands for policy rules.t
project_idtuser_idtquota_classtavailability_zonetinstance_ids
--api-nametdesttapi_nameR
s
<API name>R
sDWill return only passing policy rules containing the given API name.s--targettnargst+ttargets<Target>sœWill return only passing policy rules for the given target. The available targets are %s. When "instance_id" is used, the other targets will be overwritten.t,cCsn|jƒ}|pd}|j||ƒ}|j|||ƒ}|r\tdj|ƒƒdStdƒdSdS(sÒPrints all passing policy rules for the given user.

        :param api_name: If None, all passing policy rules will be printed,
                         otherwise, only passing policies that contain the
                         given api_name in their names.
        :param target: The target against which the policy rule authorization
                       will be tested. If None, the given user will be
                       considered as the target.
        ts
isNo rules matched or allowediN(t_get_contextt_get_targett
_filter_rulestprinttjoin(tselfRRRtallowed_operations((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pytcheck7s
cCs%tjdtjdtjdtjƒS(NtrolesRR(tnova_contexttRequestContexttCONFtos_rolest
os_user_idtos_tenant_id(R"((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pyRVs			c
Csº|s
dSi}xQ|D]I}|jdƒ\}}||jkrVtjd|ƒ‚n|||<qW|jdƒ}|r¶tjƒ}tj	||ƒ}	i|	dd6|	dd6}n|S(sÌProcesses and validates the CLI given target and adapts it for
        policy authorization.

        :returns: None if the given target is None, otherwise returns a proper
                  authorization target.
        :raises nova.exception.InvalidAttribute: if a key in the given target
            is not an acceptable.
        :raises nova.exception.InstanceNotFound: if 'instance_id' is given, and
            there is no instance match the id.
        t=tattrRRRN(
tNonetsplitt_ACCEPTABLE_TARGETSRtInvalidAttributetgetR&tget_admin_contextRtinstance_get_by_uuid(
R"RRt
new_targettttkeytvalueRt
admin_ctxttinstance((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pyR\s
cCsPtjƒ}g|D]9}||jkr|j|j|dtƒr|j^qS(Ntfatal(Rt
list_rulestnametcantFalse(R"RRRt	all_rulestrule((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pyR{sN(t__name__t
__module__t__doc__R0t
cmd_commontargsR!R.R$RRR(((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pyR0s			tpolicyt
categoriestcategoryttitlesCommand categoriessAvailable categoriesthandlercCsÎtjtƒtjtƒtjtjƒtj	j
dkrPttj
ƒƒdStj	j
dkrstjtƒdSy,tjƒ\}}}|||Ž}|SWn(tk
rÉ}ttdƒ|ƒdSXdS(s4Parse options and call the appropriate class/method.R	isbash-completions	error: %siN(R(tregister_cli_optstcli_optstregister_cli_opttcategory_optRt
parse_argstsystargvRIR=R R	tversion_string_with_packageREtprint_bash_completiont
CATEGORIESt
get_action_fnt	ExceptionR(tfntfn_argst	fn_kwargstrettex((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pytmains 


(%RDt
__future__Rt	functoolstosRQtoslo_configRtnova.cmdRREt	nova.conftnovaRRR&RRt	nova.i18nRRR	tconfR(tListOpttenvironR2tStrOptRMtobjectRRUtpartialtadd_command_parserst
SubCommandOptROR](((s4/usr/lib/python2.7/dist-packages/dmapi/cmd/policy.pyt<module>sPQ