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? [closed]

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

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 reopen merge delete

Closed for the following reason question is not relevant or outdated by binford2k
close date 2018-07-23 19:19:14.357902


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 -0600 )edit

Can you share your code so far?

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