kavya k
kavya k

Reputation: 31

How to Validate a template using Heat API Client?

Unable to Validate a template using Heat-API client,when used below method

   from heatclient.client import Client  
   heat = Client('1', endpoint=heat_url, token=auth_token)  
   heat.stacks.validate(template_file) 

Error mesage:

 TypeError: validate() takes exactly 1 argument (2 given)

Upvotes: 0

Views: 2101

Answers (2)

Kashif Siddiqui
Kashif Siddiqui

Reputation: 1546

Try

heat.stacks.validate(template=template_file) 

OR

heat.stacks.validate(template=template_file["template"])
#If your template is an inner dict  

Upvotes: 0

Hang
Hang

Reputation: 17

Here is the source code for heat client api:

def validate(self, **kwargs):
        """Validate a stack template."""
        resp, body = self.client.json_request('POST', '/validate', data=kwargs)
        return body

So, you should not put any argument in the validate() function and I would try run: heat.stacks.validate() and see what it gives you

source code

Upvotes: 1

Related Questions