Skip to content

Commit

Permalink
Do not use defaultfor to choose the only existing provider (#672)
Browse files Browse the repository at this point in the history
Do not use defaultfor to choose the only existing provider

It is sometimes useful to be able to noop (or change) a provider in
certain situations [1] (Think running a temporary container with puppet
tags to create proper config files). Currently, using defaultfor makes
overriding the current provider rabbitmqctl a very hard thing to do.

Let's switch to using the confine mechanism to make sure the provider
runs only on posix OSes while still allowing an operator to override it.

[1] https://github.com/openstack/puppet-tripleo/blob/master/lib/puppet/parser/functions/noop_resource.rb
  • Loading branch information
mbaldessari authored and EmilienM committed Dec 7, 2017
1 parent 79095ae commit 0ec48b3
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_binding/rabbitmqadmin.rb
Expand Up @@ -10,7 +10,7 @@
environment HOME: '/tmp'
end

defaultfor feature: :posix
confine feature: :posix

# Without this, the composite namevar stuff doesn't work properly.
mk_resource_methods
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_erlang_cookie/ruby.rb
@@ -1,7 +1,7 @@
require 'puppet'
require 'set'
Puppet::Type.type(:rabbitmq_erlang_cookie).provide(:ruby) do
defaultfor feature: :posix
confine feature: :posix

def exists?
# Hack to prevent the create method from being called.
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_exchange/rabbitmqadmin.rb
Expand Up @@ -12,7 +12,7 @@
environment HOME: '/tmp'
end
end
defaultfor feature: :posix
confine feature: :posix

def should_vhost
if @should_vhost
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_parameter/rabbitmqctl.rb
Expand Up @@ -3,7 +3,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
Puppet::Type.type(:rabbitmq_parameter).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
defaultfor feature: :posix
confine feature: :posix

# cache parameters
def self.parameters(name, vhost)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_plugin/rabbitmqplugins.rb
Expand Up @@ -11,7 +11,7 @@
end
end

defaultfor feature: :posix
confine feature: :posix

def self.instances
plugin_list = run_with_retries do
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_policy/rabbitmqctl.rb
Expand Up @@ -3,7 +3,7 @@

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'rabbitmqctl'))
Puppet::Type.type(:rabbitmq_policy).provide(:rabbitmqctl, parent: Puppet::Provider::Rabbitmqctl) do
defaultfor feature: :posix
confine feature: :posix

# cache policies
def self.policies(name, vhost)
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_queue/rabbitmqadmin.rb
Expand Up @@ -12,7 +12,7 @@
environment HOME: '/tmp'
end
end
defaultfor feature: :posix
confine feature: :posix

def should_vhost
if @should_vhost
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/rabbitmq_user/rabbitmqctl.rb
Expand Up @@ -7,7 +7,7 @@
environment HOME: '/tmp'
end

defaultfor feature: :posix
confine feature: :posix

def initialize(value = {})
super(value)
Expand Down
Expand Up @@ -8,7 +8,7 @@
end
end

defaultfor feature: :posix
confine feature: :posix

# cache users permissions
def self.users(name, vhost)
Expand Down

0 comments on commit 0ec48b3

Please sign in to comment.