You could set an attribute foo.nomount = true on the environments. When you call a mount resource include a not_if { node.foo.nomount } in then resource block.
Advantages: You don’t block the mount resource on certain environments. You use the attribute as a toggle able feature flag. Its not a method like chef.environment so an attribute may be easier to change across systems.
Guy Matz guymatz@gmail.com wrote:
Thanks, but I’d rather do it in one place, and be able to change it there rather than have to change it throughout my code if my requirements change
On Thu, Mar 20, 2014 at 11:43 AM, Tensibai <tensibai@iabis.netmailto:tensibai@iabis.net> wrote:
Why not enclosing the mounts with a
if node.chef_environment != ‘dev’ do
[… mounts calls and so ont … ]
end
or a
do
[…]
end unless node.chef_environment == ‘dev’
For what it worth, I wrote that without control, so I may have typos and other cross language errors, but the idea is there
Le 2014-03-20 16:40, Guy Matz a écrit :
Hi! I would like to override the mount provider so that it does try to mount in my dev environment . . I was hoping to add a mount cookbook with a provider that would simply check the chef environment and make super calls if the environment is not dev.
Is this stupid? Anyone have a better way? If this doesn’t sound terrible, then can someone say if what I want to do is possible? I couldn’t find anything on the nets about overriding providers . .
Thanks a lot,
Guy