Hi,
I currently trying to develop a custom type with Puppet Resource API.
Using this documentation:
I managed to develop something that works with attributes of behavior 'namevar' and 'readonly'.
I would like to create a new attributes of behavior 'parameter' to influence how the provider behaves (quoting the doc).
But I don't understand how you could use this kind of attributes in the provider.
Here is what I want to do :
My custom type manages host ssh keys : The current attributes are type (dsa, rsa, etc.), length (of the key), comment and 2 'read_only' attributes : the file path of private ssh key (/etc/ssh/ssh_host_rsa_key) and 'age' (the number of days since the creation of the key - based on the key file modification time). The 'type' and 'length' are both 'namevar'.
All of this works as expected :-)
Now i want to add an attribute 'parameter' called 'maxdays' and implement the following behavior: If read-only attribute 'age' is greater that attributes parameter 'maxdays', I want to trigger the generation of a new key.
I don't see a way in the get method to tell Puppet that since 'age' is greater that 'maxdays', it should call the set method to change the state of the system (ie. generate a new key).
Is this doable with Puppet Resource API ?
If yes, could you show me the way please ?
Thanks in advance for your help.
Regards,
Fred