Sha256: cadde8ba450b3539781688200a0f95c6efcde468fb9b8720fa8e726c3601f0b4

Contents?: true

Size: 1.01 KB

Versions: 23

Compression:

Stored size: 1.01 KB

Contents

module Fog
  module Vsphere
    class Compute
      class Real
        def list_processes(vm_id, opts)
          vm = get_vm_ref(vm_id)

          auth = RbVmomi::VIM::NamePasswordAuthentication(
            username: opts[:user],
            password: opts[:password],
            interactiveSession: false
          )

          p_manager = connection.serviceContent.guestOperationsManager.processManager
          processes = p_manager.ListProcessesInGuest(vm: vm, auth: auth)
          processes.map do |pi|
            Process.new(
              cmd_line: pi.cmdLine,
              end_time: pi.endTime,
              exit_code: pi.exitCode,
              name: pi.name,
              owner: pi.owner,
              pid: pi.pid,
              start_time: pi.startTime
            )
          end
        end
      end

      class Mock
        def list_processes(_vm_id, _opts = {})
          [
            Process.new(name: 'winlogon'),
            Process.new(name: 'init')
          ]
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
fog-vsphere-3.7.0 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.8 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.7 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.6 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.5 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.4 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.3 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.2 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.5.3 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.6.0 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.5.2 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.5.1 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.5.0 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.4.0 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.3.1 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.3.0 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.2.5 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.2.2 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.2.1 lib/fog/vsphere/requests/compute/list_processes.rb
fog-vsphere-3.2.0 lib/fog/vsphere/requests/compute/list_processes.rb