mirror of
https://github.com/inspec/inspec
synced 2024-11-27 07:00:39 +00:00
Merge pull request #5232 from rgeissert/processes-output-truncation-issue
Run ps with an ulimited width on linux
This commit is contained in:
commit
508861b80f
3 changed files with 3 additions and 3 deletions
|
@ -138,7 +138,7 @@ module Inspec::Resources
|
|||
command: 8,
|
||||
}
|
||||
else
|
||||
command = "ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command"
|
||||
command = "ps wwaxo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command"
|
||||
regex = /^(.+?)\s+(\d+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+(\w{3} \d{2}|\d{2}:\d{2}:\d{2})\s+([^ ]+)\s+([^ ]+)\s+(.*)$/
|
||||
field_map = {
|
||||
label: 1,
|
||||
|
|
|
@ -210,7 +210,7 @@ class MockLoader
|
|||
'find /sys/class/net/eth1/ -maxdepth 1 -type f -exec sh -c \'echo "[$(basename {})]"; cat {} || echo -n\' \;' => empty.call,
|
||||
"Get-Package -Name 'Not available' | ConvertTo-Json" => empty.call,
|
||||
"ps axo pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user,command" => cmd.call("ps-axo"),
|
||||
"ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" => cmd.call("ps-axoZ"),
|
||||
"ps wwaxo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command" => cmd.call("ps-axoZ"),
|
||||
"ps -o pid,vsz,rss,tty,stat,time,ruser,args" => cmd.call("ps-busybox"),
|
||||
"env" => cmd.call("env"),
|
||||
"${Env:PATH}" => cmd.call("$env-PATH"),
|
||||
|
|
|
@ -228,6 +228,6 @@ describe "Inspec::Resources::Processes" do
|
|||
it "returns the correct command for non-busybox linux" do
|
||||
resource = MockLoader.new(:centos7).load_resource("processes")
|
||||
resource.expects(:busybox_ps?).returns(false)
|
||||
_(resource.send(:ps_configuration_for_linux)[0]).must_equal "ps axo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command"
|
||||
_(resource.send(:ps_configuration_for_linux)[0]).must_equal "ps wwaxo label,pid,pcpu,pmem,vsz,rss,tty,stat,start,time,user:32,command"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue