<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">It looks like maybe WSME or Pecan is inspecting the method signature. Have you tried to change the order of the decorators?<div><br></div><div><br><div><div>On Aug 8, 2014, at 9:16, Pendergrass, Eric <<a href="mailto:eric.pendergrass@hp.com">eric.pendergrass@hp.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div lang="EN-US" link="blue" vlink="purple" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="WordSection1" style="page: WordSection1;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);">Wrong link again, this is embarrassing<span class="Apple-converted-space"> </span></span><span style="font-family: Wingdings; color: rgb(31, 73, 125);">L</span><span style="color: rgb(31, 73, 125);"><span class="Apple-converted-space"> </span><a href="https://review.openstack.org/#/c/112137/3" style="color: purple; text-decoration: underline;">https://review.openstack.org/#/c/112137/3</a><o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);"> </span></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"><span class="Apple-converted-space"> </span>Pendergrass, Eric<span class="Apple-converted-space"> </span><br><b>Sent:</b><span class="Apple-converted-space"> </span>Friday, August 08, 2014 7:15 AM<br><b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:openstack-dev@lists.openstack.org">openstack-dev@lists.openstack.org</a><br><b>Subject:</b><span class="Apple-converted-space"> </span>RE: [Ceilometer] Question on decorators in Ceilometer pecan framework<o:p></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);">Sorry, wrong BP review link below. Here is the correct one: <a href="https://review.openstack.org/#/c/112127/3" style="color: purple; text-decoration: underline;">https://review.openstack.org/#/c/112127/3</a>. Please disregard the wiki link.<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);"> </span></div><div><div style="border-style: solid none none; border-top-color: rgb(181, 196, 223); border-top-width: 1pt; padding: 3pt 0in 0in;"><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;">From:</span></b><span style="font-size: 10pt; font-family: Tahoma, sans-serif;"><span class="Apple-converted-space"> </span>Pendergrass, Eric<span class="Apple-converted-space"> </span><br><b>Sent:</b><span class="Apple-converted-space"> </span>Friday, August 08, 2014 6:50 AM<br><b>To:</b><span class="Apple-converted-space"> </span><a href="mailto:openstack-dev@lists.openstack.org" style="color: purple; text-decoration: underline;">openstack-dev@lists.openstack.org</a><br><b>Cc:</b><span class="Apple-converted-space"> </span>Giannetti, Fabio<br><b>Subject:</b><span class="Apple-converted-space"> </span>[Ceilometer] Question on decorators in Ceilometer pecan framework<o:p></o:p></span></div></div></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);">Hi,<o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);">We</span><span class="Apple-converted-space"> </span>have been struggling to get a decorator working for<span class="Apple-converted-space"> </span><span style="color: rgb(31, 73, 125);">proposed<span class="Apple-converted-space"> </span></span>new RBAC functionality in ceilometer-api. <span style="color: rgb(31, 73, 125);"> </span>We’re hitting a problem where GET request query parameters are mucked up by our decorator. Here’s an example call:<span style="color: rgb(31, 73, 125);"><o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">curl -H "X-Auth-Token:$TOKEN" '<a href="http://localhost:8777/v2/meters?q.field=project_id&q.value=8c678720fb5b4e3bb18dee222d7d7933'" style="color: purple; text-decoration: underline;">http://localhost:8777/v2/meters?q.field=project_id&q.value=8c678720fb5b4e3bb18dee222d7d7933'</a></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">And here’s the decorator method (we’ve tried changing the kwargs, args, etc. with no luck):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">_ENFORCER =<span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">None</span></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 191, 0);">def</span><span style="font-size: 9pt; font-family: 'Lucida Console';"><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">protected</span>(controller_class):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">global</span><span class="Apple-converted-space"> </span>_ENFORCER</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">if</span><span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">not</span><span class="Apple-converted-space"> </span>_ENFORCER:</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> _ENFORCER = policy.Enforcer()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">def</span><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">wrapper</span>(f):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 191);">@</span><span style="color: rgb(0, 191, 191);">functools.wraps</span>(f)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">def</span><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">inner</span>(self, **kwargs):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> pdb.set_trace()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> self._rbac_context = {}</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">if</span><span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">not</span><span class="Apple-converted-space"> </span>_ENFORCER.enforce(<span style="color: rgb(191, 0, 0);">'context_is_admin'</span>,</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> {},</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> {<span style="color: rgb(191, 0, 0);">'roles'</span>: pecan.request.headers.get(<span style="color: rgb(191, 0, 0);">'X-Roles'</span>,<span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 0);">""</span>).split(<span style="color: rgb(191, 0, 0);">","</span>)}):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> self._rbac_context[<span style="color: rgb(191, 0, 0);">'project_id'</span>] = pecan.request.headers.get(<span style="color: rgb(191, 0, 0);">'X-Project-Id'</span>)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> self._rbac_context[<span style="color: rgb(191, 0, 0);">'user_id'</span>] = pecan.request.headers.get(<span style="color: rgb(191, 0, 0);">'X-User-Id'</span>)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">return</span><span class="Apple-converted-space"> </span>f(self, **kwargs)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">return</span><span class="Apple-converted-space"> </span>inner</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">return</span><span class="Apple-converted-space"> </span>wrapper</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">tried this too:</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">_ENFORCER =<span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">None</span></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 191, 191);"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 191, 0);">def</span><span style="font-size: 9pt; font-family: 'Lucida Console';"><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">protected</span>(*args):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> controller_class =<span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 0);">'meter'</span></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">global</span><span class="Apple-converted-space"> </span>_ENFORCER</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">if</span><span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">not</span><span class="Apple-converted-space"> </span>_ENFORCER:</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> _ENFORCER = policy.Enforcer()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">def</span><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">wrapper</span>(f, *args):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">def</span><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">inner</span>(self, *args):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> pdb.set_trace()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"># self._rbac_context = {}</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"># if not _ENFORCER.enforce('context_is_admin',</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"># {},</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"># {'roles': pecan.request.headers.get('X-Roles', "").split(",")}):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"># self._rbac_context['project_id'] = pecan.request.headers.get('X-Project-Id')</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"># self._rbac_context['user_id'] = pecan.request.headers.get('X-User-Id')</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(0, 0, 191);">#return f(*args)</span></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> f(self, *args)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">return</span><span class="Apple-converted-space"> </span>inner</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">return</span><span class="Apple-converted-space"> </span>wrapper</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">and here’s how it’s used:<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 191, 0);">class</span><span style="font-size: 9pt; font-family: 'Lucida Console';"><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">MetersController</span>(rest.RestController):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 0);">"""Works on meters."""</span></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 0, 0);"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> _rbac_context = {}</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 191);">@</span><span style="color: rgb(0, 191, 191);">pecan.expose</span>()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">def</span><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">_lookup</span>(self, meter_name, *remainder):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">return</span><span class="Apple-converted-space"> </span>MeterController(meter_name), remainder</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 191);">@</span><span style="color: rgb(0, 191, 191);">wsme_pecan.wsexpose</span>([Meter], [Query])</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(0, 0, 191);"> @rbac_validate.protected('meters')</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">def</span><span class="Apple-converted-space"> </span><span style="color: rgb(0, 191, 191);">get_all</span>(self, q=<span style="color: rgb(0, 191, 191);">None</span>):</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> <span class="Apple-converted-space"> </span><span style="color: rgb(191, 0, 0);">"""Return all known meters, based on the data recorded so far.</span></span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 0, 0);"> </span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 0, 0);"> :param q: Filter rules for the meters to be returned.</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console'; color: rgb(191, 0, 0);"> """</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> q = q<span class="Apple-converted-space"> </span><span style="color: rgb(191, 191, 0);">or</span><span class="Apple-converted-space"> </span>[] …</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">but we get errors similar to below where the arg parser cannot find the query parameter because the decorator doesn’t take a q argument as MetersController.get_all does. <span style="color: rgb(31, 73, 125);"><o:p></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);"> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Is there any way to get a decorator to work within the v2 API code and wsme framework or should we consider another approach? Decorators would really simplify the RBAC idea we’re working on, which is mostly code-implemented save for this fairly major problem.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">I have a WIP registered BP on this at<a href="https://blueprints.launchpad.net/ceilometer/+spec/ready-ceilometer-rbac-keystone-v3" style="color: purple; text-decoration: underline;">https://blueprints.launchpad.net/ceilometer/+spec/ready-ceilometer-rbac-keystone-v3</a>.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">If I can provide more details I’ll be happy to.<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Thanks<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;">Eric<o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"> <o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/bin/ceilometer-api(10)<module>()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> sys.exit(api())</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /opt/stack/ceilometer/ceilometer/cli.py(96)api()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> srv.serve_forever()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/SocketServer.py(227)serve_forever()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self._handle_request_noblock()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/SocketServer.py(284)_handle_request_noblock()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self.process_request(request, client_address)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/SocketServer.py(310)process_request()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self.finish_request(request, client_address)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/SocketServer.py(323)finish_request()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self.RequestHandlerClass(request, client_address, self)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/SocketServer.py(638)__init__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self.handle()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/wsgiref/simple_server.py(124)handle()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> handler.run(self.server.get_app())</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/lib/python2.7/wsgiref/handlers.py(85)run()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self.result = application(self.environ, self.start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /opt/stack/python-keystoneclient/keystoneclient/middleware/auth_token.py(663)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> return self.app(env, start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /opt/stack/ceilometer/ceilometer/api/app.py(97)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> return self.v2(environ, start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/pecan/middleware/static.py(151)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> return self.app(environ, start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/pecan/middleware/debug.py(289)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> return self.app(environ, start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/pecan/middleware/recursive.py(56)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> return self.application(environ, start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /opt/stack/ceilometer/ceilometer/api/middleware.py(83)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> app_iter = self.app(environ, replacement_start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/pecan/core.py(750)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> return super(Pecan, self).__call__(environ, start_response)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/pecan/core.py(616)__call__()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> self.invoke_controller(controller, args, kwargs, state)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/pecan/core.py(526)invoke_controller()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> result = controller(*args, **kwargs)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/wsmeext/pecan.py(79)callfunction()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> pecan.request.body, pecan.request.content_type</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';"> /usr/local/lib/python2.7/dist-packages/wsme/rest/args.py(276)get_args()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> from_args = args_from_args(funcdef, args, kwargs)</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">> /usr/local/lib/python2.7/dist-packages/wsme/rest/args.py(189)args_from_args()</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="font-size: 9pt; font-family: 'Lucida Console';">-> funcdef.get_arg(argname).datatype, value</span><o:p></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="color: rgb(31, 73, 125);"> </span></div></div>_______________________________________________<br>OpenStack-dev mailing list<br><a href="mailto:OpenStack-dev@lists.openstack.org">OpenStack-dev@lists.openstack.org</a><br>http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</div></blockquote></div><br></div></body></html>