tliron / puccini

Cloud topology management and deployment tools based on TOSCA
https://puccini.cloud
Apache License 2.0
88 stars 20 forks source link

outputs is coming empty in the operations of interfaces #118

Closed ashish-gupta-2 closed 1 year ago

ashish-gupta-2 commented 1 year ago

HI ,

https://github.com/tliron/puccini/blob/main/examples/tosca/interfaces.yaml

when we are parsing & compiling ,

Then the output is missing in the operations.

                        "operations": {
                            "maintenance_off": {
                                "dependencies": [],
                                "description": "Turn maintenance mode off",
                                "implementation": "/opt/scripts/maintenance_off.sh",
                                "inputs": {
                                    "priority": 0.75
                                },
                                "outputs": {},
                                "timeout": -1
                            },
                        },

Find the full file below interface.txt

Expectation is : It should show like below

    "operations": {
                            "maintenance_off": {
                                "dependencies": [],
                                "description": "Turn maintenance mode off",
                                "implementation": "/opt/scripts/maintenance_off.sh",
                                "inputs": {
                                    "priority": 0.75
                                },
                                "outputs": {
                                                                   "timestamp": {
                                        "nodeTemplateName": "server",
                                        "target": "last_turned_off",
                                        "targetType": "attribute"
                                    }
},
                                "timeout": -1
                            },
                        },
ashish-gupta-2 commented 1 year ago

HI Tal,

Found the root cause of the above issue .

func (self NotificationAssignments) RenderForNodeTemplate(nodeTemplate NodeTemplate, definitions NotificationDefinitions, context tosca.Context) { self.render(definitions, context) for _, assignment := range self { assignment.Outputs.RenderForNodeTemplate(nodeTemplate) } }

this assignment is missing for the operation .

tliron commented 1 year ago

Thank you for finding the issue! Do you want to submit a PR or wait for me to fix it?

ashish-gupta-2 commented 1 year ago

Hi, Are you planning to do any release soon?
then please include this fix

It will be helpful

tliron commented 1 year ago

Yes, I am hoping to release next week!

ashish-gupta-2 commented 1 year ago

That will help. Please include this fix as well.

ashish-gupta-2 commented 1 year ago

Hi @tliron , I have raised a PR, Please check https://github.com/tliron/puccini/pull/119 and merge if all are ok.

tliron commented 1 year ago

Thanks! I have a few divergences to fix in the main branch, I hope to finish this weekend!

ashish-gupta-2 commented 1 year ago

Cool!

Shishqa commented 1 year ago

Hi @tliron , I have raised a PR, Please check #119 and merge if all are ok.

Hi! I've noticed that there is the same issue in relationship operations. Tried to fix the issue the same way it was fixed in the PR and came across the issue of not validating SOURCE and TARGET in output mappings.

https://github.com/tliron/puccini/blob/3289a4489ea409101d28cd8c42d7bfb6057566a2/tosca/grammars/tosca_v2_0/output-mapping.go#L20-L22 Am I wrong or this statement is incomplete?

tliron commented 1 year ago

I am about to commit a fix. Your PR put in the right direction, but actually it was missing support for relationships and groups, where interfaces may also appear.