Luke,
> Am I reading correctly that most of the work is in the type, thought? Is
> it adding the right getters and setters on the provider?
>
Yes it does. Actually it's more like a type on steroids and adding the
information the provider needs. This way it hides most of the gory details
from the provider. So using easy_type, most of the work is done in the type
and the provider becomes standard.
Here's an example of a type managing a role in an oracle database:
module Puppet
newtype(:role) do
include EasyType
include ::Utils::OracleAccess
desc "This resource allows you to manage a role in an Oracle database."
set_command(:sql)
ensurable
to_get_raw_resources do
sql "select * from dba_roles"
end
on_create do
"create role #{self[:name]}"
end
on_modify do
"alter role#{self[:name]}"
end
on_destroy do
"drop role#{self[:name]}"
end
parameter :name
property :password
end
end
The parameter and the property directive's sort of include a file. Here's
the content of the parameter file:
newparam(:name) do
include EasyType
include EasyType::Validators::Name
include EasyType::Mungers::Upcase
desc "The role name "
isnamevar
to_translate_to_resource do | raw_resource|
raw_resource.column_data('ROLE').upcase
end
end
You can check the github repository for some Oracle
types<https://github.com/hajee/oracle>
to see some of the more difficult types. Obviously it overrides the
separation of concerns between the type and the provider. But we noticed
that for types inside an Oracle database or some other middleware, there is
hardly ever the need for the indirection, the provider gives us.
Love to hear your opinion about what we did. We are open to any suggestions
you might have.
Regards,
Bert Hajee
--
You received this message because you are subscribed to the Google Groups
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-dev/5359f1d8-94ab-47df-87a7-e484668f0d12%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.