Remove sasldb file as parameter for qdr_user type

Change-Id: Id6ebc4ce8b0ffdb0be92a758dbf89c84c3274725
This commit is contained in:
Andrew Smith 2017-01-16 15:37:53 -05:00
parent df0e57b4d6
commit 3dc5db2659
4 changed files with 3 additions and 12 deletions

View File

@ -138,7 +138,6 @@ Query all current internal users: '$puppet resource qdr_user'
```puppet
qdr_user { 'anyUser' :
file => '/var/lib/qdrouterd/qdrouterd.sasldb',
password => 'changeme',
}
```

View File

@ -19,6 +19,5 @@ node default {
# qdr_user { 'SaslUser' :
# ensure => present,
# password => 'testpw',
# file => '/var/lib/qdrouterd/qdrouterd.sasldb',
# }
}

View File

@ -4,11 +4,8 @@ Puppet::Type.type(:qdr_user).provide(:sasl) do
commands :saslpasswd2 => 'saslpasswd2'
optional_commands :sasldblistusers2 => 'sasldblistusers2'
#sasldb should be a config param
def self.instances
users = []
#TODO (ansmith) - why did first and last get discarded by dp?
userlist=sasldblistusers2('-f', '/var/lib/qdrouterd/qdrouterd.sasldb').split(/\n/).each do |line|
if line =~ /^(\S+)@(\S+):.*$/
users << new(:name => $1,
@ -22,7 +19,8 @@ Puppet::Type.type(:qdr_user).provide(:sasl) do
def create
# is there a way to pipe to commands?
if not system(%{echo "#{resource[:password]}" | saslpasswd2 -f #{resource[:file]} #{resource[:name]}})
if not system(%{echo "#{resource[:password]}" | saslpasswd2 -f '/var/lib/qdrouterd/qdrouterd.sasldb' #{resource[:name]}})
raise Puppet::Error, "Failed to create user"
end
end
@ -35,7 +33,7 @@ Puppet::Type.type(:qdr_user).provide(:sasl) do
def exists?
begin
users = sasldblistusers2('-f', '/var/lib/qdrouterd/qdrouterd.sasldb').split(/\n/).detect do |user|
users = sasldblistusers2('-f', "/var/lib/qdrouterd/qdrouterd.sasldb").split(/\n/).detect do |user|
user.match(/^#{resource[:name]}@.*$/)
end
rescue

View File

@ -8,11 +8,6 @@ Puppet::Type.newtype(:qdr_user) do
newvalues(/^\S+$/)
end
newparam(:file) do
desc "The location of the sasl password file"
newvalues(/^\S+$/)
end
newparam(:password) do
desc "The user password to be set on creation"
end