projects
/
mirror
/
dsa-puppet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
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
fbd389d
..
c270361
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,23
+1,21
@@
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
- self.run_with_retries {
+ vhost_list = run_with_retries do
rabbitmqctl('-q', 'list_vhosts')
rabbitmqctl('-q', 'list_vhosts')
- }.split(/\n/).map do |line|
- if line =~ /^(\S+)$/
- new(:name => $1)
- else
- raise Puppet::Error, "Cannot parse invalid user line: #{line}"
- end
+ 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))
end
end
end
end
@@
-30,11
+28,6
@@
Puppet::Type.type(:rabbitmq_vhost).provide(:rabbitmqctl, :parent => Puppet::Prov
end
def exists?
end
def exists?
- out = self.class.run_with_retries {
- rabbitmqctl('-q', 'list_vhosts')
- }.split(/\n/).detect do |line|
- line.match(/^#{Regexp.escape(resource[:name])}$/)
- end
+ self.class.run_with_retries { rabbitmqctl('-q', 'list_vhosts') }.split(%r{\n}).include? resource[:name]
end
end
-
end
end