On Thu, Dec 16, 2010 at 01:45:17PM -0600, Umair Ghani wrote: > Hello > [...] > > But I keep getting the following error message: > err: /Stage[main]/some_name/Servicemanager[some_name]: Could not evaluate: > No ability to determine if servicemanager exists > > OR > err: Could not run Puppet configuration client: No ability to determine if > servicemanager exists > > I even tried adding a def exists? function in hostmanager.rb and that didnt > help. >
Puppet handles states not actions. So if you want to define that a service is
running, puppet must have the ability to query if it's running already.
my comments (your problem is #3 and #4)
1. you use one property for two things. What if you want to say
that your service is installed and running?
2. restarted is not really a state. But you can define that your restart
method should get called upon refresh (look in service.rb how such a
refresh method can be defined)
3. you said ensurable. That's just a shortcut to say that you have an
ensure property which handles absent and present. This means that your
type (or preferable the provider) must have three functions:
- exists? to retrieve the current state
- create to create your type if it does not exist while it should
- destroy to delete your type if it does exists while it should not
If an ensure property doesnt make any sense for your type dont say
ensurable
4. Your action property doesnt have any retrieve method so puppet cannot
check if this property is in sync or not. Because I guess a
servicemanager resource can be installed AND running, you should split
that at least in two properties. Then you have to define a retrieve
method. The default (defined in property.rb) is to just call
provider.propertyname so just add a method called »action« in
hostmanager.rb. That method must return a valid value
(:stopped or :running).
5. If you define commands :hostmanager => '...' you get a hostmanager
method for free so you can just say:
hostmanager '-s', @resource[:name], '-r', @resource[:release], '--install'
If you want to have the command as a string #{:hostmanager} just
converts the symbol hostmanager to a string (which is "hostmanager"). I
think what you wanted to say is #{command(:hostmanager)} which will give
you "/usr/local/bin/hostmanager.py"
Hope that helps.
-Stefan
pgpo5ORZfXZfy.pgp
Description: PGP signature
