Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #375. Assign environment via constructor. #376

Merged
merged 1 commit into from
Jun 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions providers/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@

# Get ShellOut
def get_shellout(cmd)
sh_cmd = Mixlib::ShellOut.new(cmd)
sh_cmd.environment = shell_environment
sh_cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
sh_cmd
end

Expand Down
3 changes: 1 addition & 2 deletions providers/parameter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def parameter_exists?(vhost, name)
cmd << " -p #{Shellwords.escape vhost}" unless vhost.nil?
cmd << " |grep '#{name}\\b'"

cmd = Mixlib::ShellOut.new(cmd)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
cmd.run_command
begin
cmd.error!
Expand Down
3 changes: 1 addition & 2 deletions providers/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
def plugin_enabled?(name)
ENV['PATH'] = "#{ENV['PATH']}:/usr/lib/rabbitmq/bin"
cmdstr = "rabbitmq-plugins list -e '#{name}\\b'"
cmd = Mixlib::ShellOut.new(cmdstr)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmdstr, :env => shell_environment)
cmd.run_command
Chef::Log.debug "rabbitmq_plugin_enabled?: #{cmdstr}"
Chef::Log.debug "rabbitmq_plugin_enabled?: #{cmd.stdout}"
Expand Down
3 changes: 1 addition & 2 deletions providers/policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def policy_exists?(vhost, name)
cmd << " -p #{Shellwords.escape vhost}" unless vhost.nil?
cmd << " |grep '#{name}\\b'"

cmd = Mixlib::ShellOut.new(cmd)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
cmd.run_command
begin
cmd.error!
Expand Down
9 changes: 3 additions & 6 deletions providers/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

def user_exists?(name)
cmd = "rabbitmqctl -q list_users |grep '^#{name}\\s'"
cmd = Mixlib::ShellOut.new(cmd)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
cmd.run_command
Chef::Log.debug "rabbitmq_user_exists?: #{cmd}"
Chef::Log.debug "rabbitmq_user_exists?: #{cmd.stdout}"
Expand All @@ -38,8 +37,7 @@ def user_exists?(name)

def user_has_tag?(name, tag)
cmd = 'rabbitmqctl -q list_users'
cmd = Mixlib::ShellOut.new(cmd)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
cmd.run_command
user_list = cmd.stdout
tags = user_list.match(/^#{name}\s+\[(.*?)\]/)[1].split
Expand All @@ -62,8 +60,7 @@ def user_has_tag?(name, tag)
def user_has_permissions?(name, vhost, perm_list = nil)
vhost = '/' if vhost.nil? # rubocop:enable all
cmd = "rabbitmqctl -q list_user_permissions #{name} | grep \"^#{vhost}\\s\""
cmd = Mixlib::ShellOut.new(cmd)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
cmd.run_command
Chef::Log.debug "rabbitmq_user_has_permissions?: #{cmd}"
Chef::Log.debug "rabbitmq_user_has_permissions?: #{cmd.stdout}"
Expand Down
3 changes: 1 addition & 2 deletions providers/vhost.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@

def vhost_exists?(name)
cmd = "rabbitmqctl -q list_vhosts | grep ^#{name}$"
cmd = Mixlib::ShellOut.new(cmd)
cmd.environment = shell_environment
cmd = Mixlib::ShellOut.new(cmd, :env => shell_environment)
cmd.run_command
Chef::Log.debug "rabbitmq_vhost_exists?: #{cmd}"
Chef::Log.debug "rabbitmq_vhost_exists?: #{cmd.stdout}"
Expand Down