Module: Chef::Mixin::ShellOut
- Included in:
- Cookbook::SyntaxCheck, Knife::CookbookSCMRepo, Knife::Ssh, Provider::Execute, Provider::File, Provider::Git, Provider::Group::Gpasswd, Provider::Group::Groupmod, Provider::Group::Suse, Provider::Link, Provider::Mdadm, Provider::Mount::Mount, Provider::Package::Apt, Provider::Package::EasyInstall, Provider::Package::Freebsd, Provider::Package::Ips, Provider::Package::Rubygems, Provider::Package::Rubygems::AlternateGemEnvironment, Provider::Package::SmartOS, Provider::RegistryKey, Provider::Service::Freebsd, Provider::Service::Init, Provider::Service::Macosx, Provider::Service::Redhat, Provider::Service::Simple, Provider::Service::Windows, Provider::User::Dscl, Resource::Conditional
- Defined in:
- lib/chef/mixin/shell_out.rb
Constant Summary collapse
- DEPRECATED_OPTIONS =
[ [:command_log_level, :log_level], [:command_log_prepend, :log_tag] ]
Instance Method Summary collapse
-
#run_command_compatible_options(command_args) ⇒ Object
CHEF-3090: Deprecate command_log_level and command_log_prepend Patterned after github.com/opscode/chef/commit/e1509990b559984b43e428d4d801c394e970f432.
- #shell_out(*command_args) ⇒ Object
- #shell_out!(*command_args) ⇒ Object
Instance Method Details
#run_command_compatible_options(command_args) ⇒ Object
CHEF-3090: Deprecate command_log_level and command_log_prepend Patterned after github.com/opscode/chef/commit/e1509990b559984b43e428d4d801c394e970f432
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/chef/mixin/shell_out.rb', line 46 def (command_args) return command_args unless command_args.last.is_a?(Hash) _command_args = command_args.dup = _command_args.last DEPRECATED_OPTIONS.each do |old_option, new_option| # Edge case: someone specifies :command_log_level and 'command_log_level' in the option hash next unless value = .delete(old_option) || .delete(old_option.to_s) deprecate_option old_option, new_option [new_option] = value end return _command_args end |
#shell_out(*command_args) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/chef/mixin/shell_out.rb', line 25 def shell_out(*command_args) cmd = Mixlib::ShellOut.new(*(command_args)) if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.debug? cmd.live_stream = STDOUT end cmd.run_command cmd end |
#shell_out!(*command_args) ⇒ Object
34 35 36 37 38 |
# File 'lib/chef/mixin/shell_out.rb', line 34 def shell_out!(*command_args) cmd= shell_out(*command_args) cmd.error! cmd end |