~gandelman-a/ubuntu/precise/facter/lp877621

« back to all changes in this revision

Viewing changes to lib/facter/util/wmi.rb

  • Committer: Adam Gandelman
  • Date: 2011-10-18 17:52:20 UTC
  • mfrom: (3.1.10 sid)
  • Revision ID: adamg@canonical.com-20111018175220-md2ha0c1kw41aox6
* Merge from Debian unstable (LP: #877621). Remaining changes:
  - debian/rules: use what we had in natty; we dont want ruby-pkg-tools
    in main. (LP: #408402)
* debian/control: Continue using ruby + libopenssl-ruby as Build-Depends
  even tho Debian has moved to gem2deb (not in main). Move ruby-json to
  Suggests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
module Facter::Util::WMI
 
2
  class << self
 
3
    def connect(uri = wmi_resource_uri)
 
4
      require 'win32ole'
 
5
      WIN32OLE.connect(uri)
 
6
    end
 
7
 
 
8
    def wmi_resource_uri( host = '.' )
 
9
      "winmgmts:{impersonationLevel=impersonate}!//#{host}/root/cimv2"
 
10
    end
 
11
 
 
12
    def execquery(query)
 
13
      connect().execquery(query)
 
14
    end
 
15
  end
 
16
end