projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "Update 3rdparty rabbitmq module"
[mirror/dsa-puppet.git]
/
3rdparty
/
modules
/
rabbitmq
/
lib
/
puppet
/
provider
/
rabbitmq_vhost
/
rabbitmqctl.rb
diff --git
a/3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb
b/3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb
index
c270361
..
fbd389d
100644
(file)
--- a/
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb
+++ b/
3rdparty/modules/rabbitmq/lib/puppet/provider/rabbitmq_vhost/rabbitmqctl.rb
@@
-1,21
+1,23
@@
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
-Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
+Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, :parent => Puppet::Provider::Rabbitmqctl) do
+
if Puppet::PUPPETVERSION.to_f < 3
if Puppet::PUPPETVERSION.to_f < 3
- commands
rabbitmqctl:
'rabbitmqctl'
+ commands
:rabbitmqctl =>
'rabbitmqctl'
else
else
- has_command(:rabbitmqctl, 'rabbitmqctl') do
- environment HOME: '/tmp'
- end
+
has_command(:rabbitmqctl, 'rabbitmqctl') do
+ environment :HOME => "/tmp"
+
end
end
def self.instances
end
def self.instances
- vhost_list = run_with_retries do
+ self.run_with_retries {
rabbitmqctl('-q', 'list_vhosts')
rabbitmqctl('-q', 'list_vhosts')
- end
-
- vhost_list.split(%r{\n}).map do |line|
- raise Puppet::Error, "Cannot parse invalid vhost line: #{line}" unless line =~ %r{^(\S+)$}
- new(name: Regexp.last_match(1))
+ }.split(/\n/).map do |line|
+ if line =~ /^(\S+)$/
+ new(:name => $1)
+ else
+ raise Puppet::Error, "Cannot parse invalid user line: #{line}"
+ end
end
end
end
end
@@
-28,6
+30,11
@@
Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, parent: Puppet::Provide
end
def exists?
end
def exists?
- self.class.run_with_retries { rabbitmqctl('-q', 'list_vhosts') }.split(%r{\n}).include? resource[:name]
+ out = self.class.run_with_retries {
+ rabbitmqctl('-q', 'list_vhosts')
+ }.split(/\n/).detect do |line|
+ line.match(/^#{Regexp.escape(resource[:name])}$/)
+ end
end
end
+
end
end