Ask Your Question

Is it mandatory to invoke custom provider methods or it will invoke itself?

asked 2017-03-03 05:15:43 -0600

Hyder gravatar image

I have developed my own type and provider. when I apply none of the method is invoking from provider.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-03 06:18:14 -0600

puser gravatar image

Some source code would be helpful here. There are three main functions of a provider ( theoretically ) that you should invoke methods within. Exists, Destroy, Create. You should be running functions / code in each of these in order to determine an action.

For example in your exists function you should be running methods / code that will check if the value already exists. Based on that decision, if they ensure => present for example you can invoke your create methods which is going to create whatever resource you are managing. The same goes for destroy.

In your manifests you aren't calling any functions that are defined inside your provider, the ensure => someval will be your determination of what action needs to be done and then using input parameters you can create the resource.

edit flag offensive delete link more


Thanks alot Eric but if my type doesnt use ensure then how to invoke them.

Hyder gravatar imageHyder ( 2017-03-03 08:48:52 -0600 )edit

What does your type do? It should be a definition to manage a resource that you are defining. There should be an ensure I would think.

puser gravatar imagepuser ( 2017-03-03 10:26:29 -0600 )edit

I have my own python code which creates VMs on ESX. I have developed a custom type that takes required input and gives it to my provider and provider will call my python code to create VMs based on given input.

Hyder gravatar imageHyder ( 2017-03-04 02:50:28 -0600 )edit

so you would ensure true that you want the vm to exist. Look at the ensurable property.

puser gravatar imagepuser ( 2017-03-05 03:49:42 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-03-03 05:15:43 -0600

Seen: 29 times

Last updated: Mar 03 '17