Custom policy Issues

Bug #1712076 reported by MANAS
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
TOSCA Parser
In Progress
High
gregoire gesmier

Bug Description

Problem:
The custom policies are not handled by TOSCA_PARSER.
It looks for the parent definition in the TOSCA_DEF whereas it should look for the definition in the custom_def.

The code should look like::

 def _get_parent_policies(self):
        policies = {}
        parent_policy = self.parent_type.type if self.parent_type else None
        if parent_policy:
            while parent_policy != 'tosca.policies.Root':
                if parent_policy in self.TOSCA_DEF:
                   policies[parent_policy] = self.TOSCA_DEF[parent_policy]
                   parent_policy = policies[parent_policy]['derived_from']
                elif self.custom_def:
                   if parent_policy in self.custom_def:
                      policies[parent_policy] = self.custom_def[parent_policy]
                      parent_policy = policies[parent_policy]['derived_from']

        return policies

Revision history for this message
MANAS (manaskrmal) wrote :

Please assign to me I can submit the code fix.

Revision history for this message
Sahdev Zala (spzala) wrote :

Thanks Manas! Yours now.

Changed in tosca-parser:
assignee: nobody → MANAS (manaskrmal)
Changed in tosca-parser:
status: New → In Progress
importance: Undecided → High
Revision history for this message
MANAS (manaskrmal) wrote :

raised the code review. https://review.openstack.org/#/c/498797/
Please add the reviewers.

Revision history for this message
gregoire gesmier (gregges) wrote :

can we please review this bug and merge it

Revision history for this message
Bob Haddleton (bob-haddleton) wrote :

The patchset was reviewed and the originator has not responded to the comments.

If you need this fix feel free to assume ownership of the patch given the amount of time that has passed.

Changed in tosca-parser:
assignee: MANAS (manaskrmal) → gregoire gesmier (gregges)
Revision history for this message
gregoire gesmier (gregges) wrote :

Hi,

thanks for that, I just assume ownership of the patch now, however I'm not sure of the step to do next as the patch passed the check. What should I do?

Revision history for this message
Bob Haddleton (bob-haddleton) wrote :

You can checkout the patch (git fetch https://git.openstack.org/openstack/tosca-parser refs/changes/97/498797/11 && git checkout FETCH_HEAD) and update the commit message with the Closes-Bug: tag as requested by Sahdev. You can add a Co-Authored-By: with your information so you get credit for assisting with the change.

Maybe also add a comment to the test - as Sahdev mentioned it is not obvious where the derived-from policy is defined, or if it is expected to have a definition somewhere.

Thanks for the help!

Revision history for this message
gregoire gesmier (gregges) wrote :

Okay I've added some comments and amended the commit, should I push it then?

Revision history for this message
gregoire gesmier (gregges) wrote :

Okay, after I amended the commit I did a git review with the Closes-Bug line added. This created a new patch, what should be done now to merge it to the master?

Revision history for this message
Bob Haddleton (bob-haddleton) wrote : Re: [Bug 1712076] Re: Custom policy Issues

Thanks Gregoire.  The builds failed due to a regression in the tests
that was introduced recently.  I'll add the fix for the regression to
that patchset and see if it builds successfully.  Once the builds pass
we can go ahead and merge it.

Bob

On 6/1/2018 5:35 AM, gregoire gesmier wrote:
> Okay, after I amended the commit I did a git review with the Closes-Bug
> line added. This created a new patch, what should be done now to merge
> it to the master?
>

Revision history for this message
gregoire gesmier (gregges) wrote :

Thanks, because I didn't understand why that happened, when I only edited some comments!

Revision history for this message
gregoire gesmier (gregges) wrote :

Thanks for the changes, and the commit! Do you know when will be the next time that the TOSCA Parser will be updated in the pip repository?

Greg.

Revision history for this message
Bob Haddleton (bob-haddleton) wrote :

Greg - I have one more patch that I want to land this week and then I'll look at a release.

Revision history for this message
gregoire gesmier (gregges) wrote :

Also in the properties of a policy, the get_input is not resolved as it is in the node_templates. I haven't saw anything related to it in the list of bug (I don't know if I missed it somewhere?) should I report a new bug related to this?

Revision history for this message
Bob Haddleton (bob-haddleton) wrote :

Thanks - that would be great.

Bob

> On Jun 4, 2018, at 09:25, gregoire gesmier <email address hidden> wrote:
>
> Also in the properties of a policy, the get_input is not resolved as it
> is in the node_templates. I haven't saw anything related to it in the
> list of bug (I don't know if I missed it somewhere?) should I report a
> new bug related to this?
>
> --
> You received this bug notification because you are subscribed to TOSCA
> Parser.
> Matching subscriptions: tosca-parser-bugs
> https://bugs.launchpad.net/bugs/1712076
>
> Title:
> Custom policy Issues
>
> Status in TOSCA Parser:
> In Progress
>
> Bug description:
> Problem:
> The custom policies are not handled by TOSCA_PARSER.
> It looks for the parent definition in the TOSCA_DEF whereas it should look for the definition in the custom_def.
>
> The code should look like::
>
> def _get_parent_policies(self):
> policies = {}
> parent_policy = self.parent_type.type if self.parent_type else None
> if parent_policy:
> while parent_policy != 'tosca.policies.Root':
> if parent_policy in self.TOSCA_DEF:
> policies[parent_policy] = self.TOSCA_DEF[parent_policy]
> parent_policy = policies[parent_policy]['derived_from']
> elif self.custom_def:
> if parent_policy in self.custom_def:
> policies[parent_policy] = self.custom_def[parent_policy]
> parent_policy = policies[parent_policy]['derived_from']
>
> return policies
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/tosca-parser/+bug/1712076/+subscriptions

Revision history for this message
gregoire gesmier (gregges) wrote :

Hi Bob,

sorry for the late reply, work has been hectic... will create the bug now

Greg.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tosca-parser 1.1.0

This issue was fixed in the openstack/tosca-parser 1.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.