wbem 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +20 -0
- data/Gemfile +2 -0
- data/MIT-LICENSE +22 -0
- data/Rakefile +6 -0
- data/bin/genclassinfo +59 -0
- data/lib/wbem.rb +8 -4
- data/lib/wbem/cimxml.rb +73 -1
- data/lib/wbem/class_factory.rb +163 -0
- data/lib/wbem/class_template.erb +48 -0
- data/lib/wbem/conversion.rb +173 -0
- data/lib/wbem/openwsman.rb +51 -0
- data/lib/wbem/version.rb +1 -1
- data/lib/wbem/wbem.rb +108 -4
- data/lib/wbem/wsman.rb +58 -168
- data/lib/wbem/wsman_instance.rb +148 -0
- data/samples/amt.rb +129 -0
- data/samples/enum.rb +34 -0
- data/samples/get.rb +47 -0
- data/tasks/clean.rake +2 -0
- data/tasks/doc.rake +15 -0
- data/tasks/test.rake +6 -0
- data/test/helper.rb +3 -0
- data/test/test_class_factory.rb +25 -0
- data/test/test_classnames.rb +68 -0
- data/test/test_connect.rb +91 -0
- data/test/test_epr.rb +27 -0
- data/test/test_loading.rb +13 -0
- data/test/test_namespaces.rb +28 -0
- data/test/test_product.rb +56 -0
- data/test/test_profiles.rb +33 -0
- data/test/test_services.rb +33 -0
- data/test/test_systems.rb +34 -0
- data/wbem.gemspec +37 -0
- metadata +76 -7
@@ -0,0 +1,91 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class TestConnect < Test::Unit::TestCase
|
6
|
+
#def setup
|
7
|
+
# Wbem.debug = true
|
8
|
+
#end
|
9
|
+
#def teardown
|
10
|
+
#end
|
11
|
+
def test_connect_http_80
|
12
|
+
assert_raise Sfcc::Cim::ErrorFailed do
|
13
|
+
Wbem::Client.connect("http://wsman:secret@localhost")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
def test_connect_https_443
|
17
|
+
assert_raise RuntimeError do
|
18
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost")
|
19
|
+
assert c
|
20
|
+
end
|
21
|
+
end
|
22
|
+
def test_connect_port_5988
|
23
|
+
assert_raise Sfcc::Cim::ErrorFailed do
|
24
|
+
# 5988 -> http, cimxml
|
25
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost:5988")
|
26
|
+
assert c
|
27
|
+
assert c.is_a? Wbem::CimxmlClient
|
28
|
+
end
|
29
|
+
end
|
30
|
+
def test_connect_port_5985
|
31
|
+
# 5985 -> http, wsman
|
32
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost:5985")
|
33
|
+
assert c
|
34
|
+
assert c.is_a? Wbem::WsmanClient
|
35
|
+
end
|
36
|
+
def test_connect_port_5989
|
37
|
+
# 5989 -> https, cimxml
|
38
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989")
|
39
|
+
assert c
|
40
|
+
assert c.is_a? Wbem::CimxmlClient
|
41
|
+
end
|
42
|
+
def test_connect_port_5986
|
43
|
+
assert_raise RuntimeError do
|
44
|
+
# 5986 -> https, wsman
|
45
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5986")
|
46
|
+
assert c
|
47
|
+
assert c.is_a? Wbem::WsmanClient
|
48
|
+
end
|
49
|
+
end
|
50
|
+
def test_connect_protocol_cimxml
|
51
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost", :cimxml)
|
52
|
+
assert c
|
53
|
+
assert c.is_a? Wbem::CimxmlClient
|
54
|
+
end
|
55
|
+
def test_connect_protocol_wsman
|
56
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost", :wsman)
|
57
|
+
assert c
|
58
|
+
assert c.is_a? Wbem::WsmanClient
|
59
|
+
end
|
60
|
+
def test_connect_protocol_http_cimxml
|
61
|
+
assert_raise Sfcc::Cim::ErrorFailed do
|
62
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost:5988", :cimxml)
|
63
|
+
assert c
|
64
|
+
assert c.is_a? Wbem::CimxmlClient
|
65
|
+
end
|
66
|
+
end
|
67
|
+
def test_connect_protocol_https_cimxml
|
68
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989", :cimxml)
|
69
|
+
assert c
|
70
|
+
assert c.is_a? Wbem::CimxmlClient
|
71
|
+
end
|
72
|
+
def test_connect_protocol_http_wsman
|
73
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost:5985", :wsman)
|
74
|
+
assert c
|
75
|
+
assert c.is_a? Wbem::WsmanClient
|
76
|
+
end
|
77
|
+
def test_connect_protocol_https_wsman
|
78
|
+
assert_raise RuntimeError do
|
79
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5986", :wsman)
|
80
|
+
assert c
|
81
|
+
assert c.is_a? Wbem::WsmanClient
|
82
|
+
end
|
83
|
+
end
|
84
|
+
def test_connect_amt
|
85
|
+
assert_raise RuntimeError do
|
86
|
+
c = Wbem::Client.connect("http://admin:P4ssw0rd!@10.10.103.60:16992/wsman", :wsman)
|
87
|
+
assert c
|
88
|
+
assert c.is_a? Wbem::WsmanClient
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
data/test/test_epr.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class TestEpr < Test::Unit::TestCase
|
6
|
+
def show instance
|
7
|
+
assert instance
|
8
|
+
puts instance
|
9
|
+
end
|
10
|
+
#def setup
|
11
|
+
#end
|
12
|
+
#def teardown
|
13
|
+
#end
|
14
|
+
def test_epr_winrm
|
15
|
+
c = Wbem::Client.connect("http://wsman:secret@wsman2003sp2.suse.de:5985", :wsman, :basic)
|
16
|
+
assert c
|
17
|
+
show c.profiles
|
18
|
+
end
|
19
|
+
def test_epr_iamt
|
20
|
+
c = Wbem::Client.connect("http://admin:P4ssw0rd!@10.160.64.28:16992", :wsman, :digest)
|
21
|
+
assert c
|
22
|
+
c.systems.each do |epr|
|
23
|
+
show c.get(epr)
|
24
|
+
show c.get(epr.to_s)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class TestNamespaces < Test::Unit::TestCase
|
6
|
+
#def setup
|
7
|
+
#end
|
8
|
+
#def teardown
|
9
|
+
#end
|
10
|
+
def test_namespaces_cimxml
|
11
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989", :cimxml)
|
12
|
+
assert c
|
13
|
+
ns = c.namespaces
|
14
|
+
assert ns
|
15
|
+
assert ns.size > 0
|
16
|
+
assert ns.include? "root/cimv2"
|
17
|
+
puts ns.inspect
|
18
|
+
end
|
19
|
+
def test_namespaces_winrm
|
20
|
+
c = Wbem::Client.connect("http://wsman:secret@wsman2003sp2.suse.de:5985", :wsman, :basic)
|
21
|
+
assert c
|
22
|
+
ns = c.namespaces
|
23
|
+
assert ns
|
24
|
+
assert ns.size > 0
|
25
|
+
assert ns.include? "root/CIMV2"
|
26
|
+
puts ns.inspect
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class TestProduct < Test::Unit::TestCase
|
6
|
+
def setup
|
7
|
+
Wbem.debug = true
|
8
|
+
end
|
9
|
+
#def teardown
|
10
|
+
#end
|
11
|
+
def test_product_port_5988
|
12
|
+
# 5989 -> https, cimxml
|
13
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989")
|
14
|
+
assert c
|
15
|
+
assert c.is_a? Wbem::CimxmlClient
|
16
|
+
assert c.product
|
17
|
+
puts "#{c.url} : #{c.product}"
|
18
|
+
end
|
19
|
+
def test_product_port_5985
|
20
|
+
# 5985 -> http, wsman
|
21
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost:5985")
|
22
|
+
assert c
|
23
|
+
assert c.is_a? Wbem::WsmanClient
|
24
|
+
assert c.product
|
25
|
+
puts "#{c.url} : #{c.product}"
|
26
|
+
end
|
27
|
+
def test_product_protocol_cimxml
|
28
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost", :cimxml)
|
29
|
+
assert c
|
30
|
+
assert c.is_a? Wbem::CimxmlClient
|
31
|
+
assert c.product
|
32
|
+
puts "#{c.url} : #{c.product}"
|
33
|
+
end
|
34
|
+
def test_product_protocol_wsman
|
35
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost", :wsman)
|
36
|
+
assert c
|
37
|
+
assert c.is_a? Wbem::WsmanClient
|
38
|
+
assert c.product
|
39
|
+
puts "#{c.url} : #{c.product}"
|
40
|
+
end
|
41
|
+
def test_product_protocol_https_cimxml
|
42
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989", :cimxml)
|
43
|
+
assert c
|
44
|
+
assert c.is_a? Wbem::CimxmlClient
|
45
|
+
assert c.product
|
46
|
+
puts "#{c.url} : #{c.product}"
|
47
|
+
end
|
48
|
+
def test_product_protocol_http_wsman
|
49
|
+
c = Wbem::Client.connect("http://wsman:secret@localhost:5985", :wsman)
|
50
|
+
assert c
|
51
|
+
assert c.is_a? Wbem::WsmanClient
|
52
|
+
assert c.product
|
53
|
+
puts "#{c.url} : #{c.product}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class TestProfiles < Test::Unit::TestCase
|
6
|
+
def show profiles
|
7
|
+
assert profiles
|
8
|
+
assert profiles.size > 0
|
9
|
+
puts "test_profiles_cimxml: #{profiles.size} profiles"
|
10
|
+
profiles.each do |profile|
|
11
|
+
puts "ns #{profile.namespace}, class #{profile.classname}, InstanceID #{profile.InstanceID}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
#def setup
|
15
|
+
#end
|
16
|
+
#def teardown
|
17
|
+
#end
|
18
|
+
def test_profiles_cimxml
|
19
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989", :cimxml)
|
20
|
+
assert c
|
21
|
+
show c.profiles
|
22
|
+
end
|
23
|
+
def test_profiles_winrm
|
24
|
+
c = Wbem::Client.connect("http://wsman:secret@wsman2003sp2.suse.de:5985", :wsman, :basic)
|
25
|
+
assert c
|
26
|
+
show c.profiles
|
27
|
+
end
|
28
|
+
def test_profiles_iamt
|
29
|
+
c = Wbem::Client.connect("http://admin:P4ssw0rd!@10.160.64.28:16992", :wsman, :digest)
|
30
|
+
assert c
|
31
|
+
show c.profiles
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class Testservices < Test::Unit::TestCase
|
6
|
+
def show services
|
7
|
+
assert services
|
8
|
+
assert services.size > 0
|
9
|
+
puts "test_services_cimxml: #{services.size} services"
|
10
|
+
services.each do |service|
|
11
|
+
puts "ns #{service.namespace}, class #{service.classname}, Name #{service.Name}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
#def setup
|
15
|
+
#end
|
16
|
+
#def teardown
|
17
|
+
#end
|
18
|
+
def test_services_cimxml
|
19
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989", :cimxml)
|
20
|
+
assert c
|
21
|
+
show c.services
|
22
|
+
end
|
23
|
+
def test_services_winrm
|
24
|
+
c = Wbem::Client.connect("http://wsman:secret@wsman2003sp2.suse.de:5985", :wsman, :basic)
|
25
|
+
assert c
|
26
|
+
show c.services
|
27
|
+
end
|
28
|
+
def test_services_iamt
|
29
|
+
c = Wbem::Client.connect("http://admin:P4ssw0rd!@10.160.64.28:16992", :wsman, :digest)
|
30
|
+
assert c
|
31
|
+
show c.services
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
$: << File.dirname(__FILE__)
|
2
|
+
require 'helper'
|
3
|
+
require 'wbem'
|
4
|
+
|
5
|
+
class TestSystems < Test::Unit::TestCase
|
6
|
+
def show systems
|
7
|
+
assert systems
|
8
|
+
assert systems.size > 0
|
9
|
+
puts "test_systems_cimxml: #{systems.size} systems"
|
10
|
+
systems.each do |system|
|
11
|
+
puts "**>#{system}<**"
|
12
|
+
# puts "ns #{system.namespace}, class #{system.classname}, Name #{system.Name}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
#def setup
|
16
|
+
#end
|
17
|
+
#def teardown
|
18
|
+
#end
|
19
|
+
def test_systems_cimxml
|
20
|
+
c = Wbem::Client.connect("https://wsman:secret@localhost:5989", :cimxml)
|
21
|
+
assert c
|
22
|
+
show c.systems
|
23
|
+
end
|
24
|
+
def test_systems_winrm
|
25
|
+
c = Wbem::Client.connect("http://wsman:secret@wsman2003sp2.suse.de:5985", :wsman, :basic)
|
26
|
+
assert c
|
27
|
+
show c.systems
|
28
|
+
end
|
29
|
+
def test_profiles_iamt
|
30
|
+
c = Wbem::Client.connect("http://admin:P4ssw0rd!@10.160.64.28:16992", :wsman, :digest)
|
31
|
+
assert c
|
32
|
+
show c.systems
|
33
|
+
end
|
34
|
+
end
|
data/wbem.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
require "wbem/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = "wbem"
|
8
|
+
s.version = Wbem::VERSION
|
9
|
+
s.platform = Gem::Platform::RUBY
|
10
|
+
s.authors = ["Klaus Kämpf"]
|
11
|
+
s.email = ["kkaempf@suse.de"]
|
12
|
+
s.homepage = "http://www.github.com/kkaempf/ruby-wbem"
|
13
|
+
s.summary = "WBEM client for Ruby based on ruby-sfcc and openwsman"
|
14
|
+
s.description = "ruby-wbem allows to access a CIMOM transparently through CIM/XML or WS-Management"
|
15
|
+
|
16
|
+
s.required_rubygems_version = ">= 1.3.6"
|
17
|
+
s.add_development_dependency("yard", [">= 0.5"])
|
18
|
+
s.add_dependency("sfcc", [">= 0.4.1"])
|
19
|
+
s.add_dependency("openwsman", [">= 2.4.14"])
|
20
|
+
s.add_dependency("cim", [">= 1.4.2"])
|
21
|
+
s.add_dependency("mof", [">= 1.2.4"])
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.files.reject! { |fn| fn == '.gitignore' }
|
25
|
+
s.require_path = 'lib'
|
26
|
+
s.extra_rdoc_files = Dir['README.rdoc', 'CHANGES.rdoc', 'MIT-LICENSE']
|
27
|
+
s.test_files = `git ls-files -- test/*`.split("\n")
|
28
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
29
|
+
|
30
|
+
s.post_install_message = <<-POST_INSTALL_MESSAGE
|
31
|
+
____
|
32
|
+
/@ ~-.
|
33
|
+
\/ __ .- | remember to have fun!
|
34
|
+
// // @
|
35
|
+
|
36
|
+
POST_INSTALL_MESSAGE
|
37
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wbem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Klaus Kämpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -44,28 +44,86 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
47
|
+
version: 2.4.14
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
54
|
+
version: 2.4.14
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cim
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.4.2
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.4.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mof
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.2.4
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.2.4
|
55
83
|
description: ruby-wbem allows to access a CIMOM transparently through CIM/XML or WS-Management
|
56
84
|
email:
|
57
85
|
- kkaempf@suse.de
|
58
|
-
executables:
|
86
|
+
executables:
|
87
|
+
- genclassinfo
|
59
88
|
extensions: []
|
60
|
-
extra_rdoc_files:
|
89
|
+
extra_rdoc_files:
|
90
|
+
- README.rdoc
|
91
|
+
- MIT-LICENSE
|
61
92
|
files:
|
62
93
|
- CHANGELOG.rdoc
|
94
|
+
- Gemfile
|
95
|
+
- MIT-LICENSE
|
63
96
|
- README.rdoc
|
97
|
+
- Rakefile
|
98
|
+
- bin/genclassinfo
|
64
99
|
- lib/wbem.rb
|
65
100
|
- lib/wbem/cimxml.rb
|
101
|
+
- lib/wbem/class_factory.rb
|
102
|
+
- lib/wbem/class_template.erb
|
103
|
+
- lib/wbem/conversion.rb
|
104
|
+
- lib/wbem/openwsman.rb
|
66
105
|
- lib/wbem/version.rb
|
67
106
|
- lib/wbem/wbem.rb
|
68
107
|
- lib/wbem/wsman.rb
|
108
|
+
- lib/wbem/wsman_instance.rb
|
109
|
+
- samples/amt.rb
|
110
|
+
- samples/enum.rb
|
111
|
+
- samples/get.rb
|
112
|
+
- tasks/clean.rake
|
113
|
+
- tasks/doc.rake
|
114
|
+
- tasks/test.rake
|
115
|
+
- test/helper.rb
|
116
|
+
- test/test_class_factory.rb
|
117
|
+
- test/test_classnames.rb
|
118
|
+
- test/test_connect.rb
|
119
|
+
- test/test_epr.rb
|
120
|
+
- test/test_loading.rb
|
121
|
+
- test/test_namespaces.rb
|
122
|
+
- test/test_product.rb
|
123
|
+
- test/test_profiles.rb
|
124
|
+
- test/test_services.rb
|
125
|
+
- test/test_systems.rb
|
126
|
+
- wbem.gemspec
|
69
127
|
homepage: http://www.github.com/kkaempf/ruby-wbem
|
70
128
|
licenses: []
|
71
129
|
metadata: {}
|
@@ -90,4 +148,15 @@ rubygems_version: 2.4.5
|
|
90
148
|
signing_key:
|
91
149
|
specification_version: 4
|
92
150
|
summary: WBEM client for Ruby based on ruby-sfcc and openwsman
|
93
|
-
test_files:
|
151
|
+
test_files:
|
152
|
+
- test/helper.rb
|
153
|
+
- test/test_class_factory.rb
|
154
|
+
- test/test_classnames.rb
|
155
|
+
- test/test_connect.rb
|
156
|
+
- test/test_epr.rb
|
157
|
+
- test/test_loading.rb
|
158
|
+
- test/test_namespaces.rb
|
159
|
+
- test/test_product.rb
|
160
|
+
- test/test_profiles.rb
|
161
|
+
- test/test_services.rb
|
162
|
+
- test/test_systems.rb
|