CLOUDSTACK-7143: protect against old ruby
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/e43e0838 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e43e0838 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e43e0838 Branch: refs/heads/master Commit: e43e08389328aa45689f184ec34509437c11c3be Parents: 64f4fb1 Author: Leo Simons <lsim...@schubergphilis.com> Authored: Fri Sep 19 15:15:16 2014 +0200 Committer: Rohit Yadav <rohit.ya...@shapeblue.com> Committed: Mon Sep 22 21:38:17 2014 +0200 ---------------------------------------------------------------------- tools/appliance/vbox_vm_clean.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e43e0838/tools/appliance/vbox_vm_clean.rb ---------------------------------------------------------------------- diff --git a/tools/appliance/vbox_vm_clean.rb b/tools/appliance/vbox_vm_clean.rb index bbbc85a..a0e34e6 100755 --- a/tools/appliance/vbox_vm_clean.rb +++ b/tools/appliance/vbox_vm_clean.rb @@ -31,8 +31,11 @@ vms.each do |vmline| ProcTable.ps { |p| next unless p.cmdline.include? "VBoxHeadless" next unless p.cmdline.include? vm_name - # VBoxManage should only list _our_ vms, but just to be safe... - next unless p.ruid == Process.uid + # not all rubies / proctables expose ruid + if defined? p.ruid + # VBoxManage should only list _our_ vms, but just to be safe... + next unless p.ruid == Process.uid + end puts "kill -SIGKILL #{p.pid}" begin