Skip to content

Commit 3691f7f

Browse files
authored
Merge pull request #962 from bugfood/missing-command
add a workaround for running with --noop or --tags
2 parents ce13eb5 + 8a3a27a commit 3691f7f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

lib/puppet/provider/rabbitmq_cli.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ def self.rabbitmqctl_list(resource, *opts)
5454
['-q']
5555
end
5656
rabbitmqctl("list_#{resource}", *list_opts, *opts)
57+
rescue Puppet::MissingCommand
58+
# rabbitmqctl is not present. Normally we would have installed a package
59+
# that provides rabbitmqctl by now, but if we're running under --noop or
60+
# with a restrictive set of tags, the package may not have been installed.
61+
# Return an empty string to avoid error. This may give false positives for
62+
# resources under --noop!
63+
Puppet.debug('rabbitmqctl command not found; assuming rabbitmq is not installed')
64+
''
5765
end
5866

5967
def self.rabbitmq_running

lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def self.plugin_list
1818
# To preserve idempotency we should get all enabled plugins regardless of implicitly or
1919
# explicitly enabled.
2020
rabbitmqplugins('list', '-e', '-m')
21+
rescue Puppet::MissingCommand
22+
# See note about Puppet::MissingCommand in:
23+
# lib/puppet/provider/rabbitmq_cli.rb
24+
Puppet.debug('rabbitmqplugins command not found; assuming rabbitmq is not installed')
25+
''
2126
end
2227
# Split by newline.
2328
lines = list_str.split(%r{\n})

0 commit comments

Comments
 (0)