Crosspost to puppet-dev to get better feedback.

On Sat, Jul 13, 2013 at 7:54 AM, Jakov Sosic <[email protected]> wrote:

> I'm trying to program custom type for managing Couchbase buckets.
>
> Problem is that every RW operation to Couchbase cluster (creating,
> deleting, resizing bucket) requires admin privileges (username/password).
>
>
> Do you have any suggestion how should I pass the username/password to
> provider? If I make it a param, then every resource of type
> 'couchbucket' will need to have 'username =>' and 'password =>' params,
> which will (probably) be the same across the board.
>

There's two options, one to store the username/password on server like
mysql resource (~/my.cnf), or in catalog. I had discussions where some
users prefer the former, but I'm in the later camp.

Now, to circumvent that repetition, I'm thinking of maybe setting
> something like:
>
> Couchbucket {
>   username => $::couchbase::admin_user,
>   password => $::couchbase::admin_password,
> }
>
> in the '::couchbase' class. Offcourse there will be similar settings for
> hostname and port of the couchnode, and probably something like purge =>
> true.
>

This works, just slightly cumbersome.

But still, if someone wants to use the type without including the base
> class, this is obviously not a viable option, because he will have to
> address the username/password in every couchbucket resource definition.
>
> So, what I am interested in is your opinion about how to proceed with
> this one.
>

In vmware modules, we use a transport resource to specify connectivity.

https://github.com/vmware/vmware-vcsa/blob/master/manifests/init.pp#L44-L51

Right now, transport is a resource and metaparameter, but I think there's
some value perhaps to turn it back to a regular parameter so we can specify
defaults.

Puppet::Type.newtype(:couchbucket) do
...
  newparam(:transport) do
    defaultto 'couch'
  end
end

This should allow a one time specification of username password for all
resources:

transport { 'couch'
  username => ...
  password => ...,
}

couchbucket { 'a':
  #transport => 'couch' implied
}

You can find examples in the vmware module how we search the catalog to
find the transport data to initialize and reuse connection.

I've intended to convert transport to a stand alone module and support the
following usage:

1. simple store for username/password (for your exact usage).
2. transport ssh.
3. transport rest.
4. transport soap.

Maybe that would be of interest? I have some other ideas about how to take
advantage of the catalog as data, instead of just resource, but that's
probably going to deviate from this topic.

Thanks,

Nan

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to