I have a Puppet resource that generate it's own id's, so the namevar I use to create the resource is not the one I can use to update the resource for example. Is this supported?

asked 2014-08-22 20:37:12 -0500

christian.cadieux gravatar image

In my scenario, each role can include multiple authorizations. I model roles and authorizations with custom types. When I create an authorization, it's name is 'schema' for example. The system will return auth-001 when it generates the authorization and I have to use 'auth-001' to update that authorization. Is it possible when writing the provider for this 'authorization' type to change the current namevar value before exiting the 'create' function of the provider?

edit retag flag offensive close merge delete

Comments

On a second run, how would you identify the ID in the system again (e.g. for a property update)? I wouldn't think about changing namevar values etc, but create a getter which uses the namevar+other parameters to find the resource again on each run. (`def obj; @obj ||= find(resource[:name]); end`)

domcleal gravatar imagedomcleal ( 2014-08-25 10:44:44 -0500 )edit

Can you share your code so far?

WhatsARanjit gravatar imageWhatsARanjit ( 2014-08-26 13:43:43 -0500 )edit