jamtur01 / jamtur01-httpauth

Puppet type and provider for managing HTTP Basic and Digest Authentication
15 stars 12 forks source link

user as a parameter #3

Closed ranamalo closed 6 years ago

ranamalo commented 11 years ago

Right now the user has to be the resource name. However if you want use that user name in two different realms and two different htpasswd files you can't. If it was a parameter you could.

jamtur01 commented 11 years ago

So what should be the new name variable be?

ranamalo commented 11 years ago

username?

jamtur01 commented 11 years ago

Don't see how that gets around the problem?

ranamalo commented 11 years ago

You are right. Sorry misread your question. Could we just have the title be the name variable and have something like this:

httpauth { 'user_realm1': username => 'user' file => '/etc/httpd/htpasswd/.realm1', password => 'blah', realm => 'realm1', mechanism => basic, ensure => present, }

httpauth { 'user_realm2': username => 'user' file => '/etc/httpd/htpasswd/.realm2', password => 'blah', realm => 'realm2', mechanism => basic, ensure => present, }

StephenBrown2 commented 11 years ago

I agree with this sentiment. I ran into this issue testing out the same username using basic and digest authentication, and it won't let me because the resources have the same name.

I tried adding a new parameter ':user' which defaulted to ':name' if not specified, but that just got me multiple entries with the literal string 'name' as the username, and the appropriate realm and password. Other variations (value(:name), self[:name], @?resource[:name]) give me errors including saying 'Error: Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias Httpauth[user-basic] to ["user"] at /tmp/vagrant-puppet/manifests/default.pp:31; resource ["Httpauth", "user"] already declared at /tmp/vagrant-puppet/manifests/default.pp:22 at /tmp/vagrant-puppet/manifests/default.pp:31 on node localhost.localdomain'

Unfortunately I don't know ruby all that well, and the puppet documentation doesn't give any way that I can see for a parameter default to another given parameter, aside from isnamevar. I think that the Then the provider would have to use the 'user' value, as opposed to the 'name' value.

jamtur01 commented 6 years ago

Fixed by #6