plainprograms-virtuozzo 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ = CHANGELOG
2
+
3
+ == 0.1.1 "Big Boy Busted"
4
+
5
+ * Fixed a bunch of errors in the generate code from wsdl2ruby and resolved
6
+ some oddness in the Connection#initialize methods implementation.
7
+ * Basic operations work!
8
+
1
9
  == 0.1.0 "Big Boy"
2
10
 
3
11
  * After finding a bug in the way Virtuozzo handles parsing of SOAP headers
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'echoe'
3
3
  require 'spec/rake/spectask'
4
4
 
5
- Echoe.new('virtuozzo', '0.1.0') do |p|
5
+ Echoe.new('virtuozzo', '0.1.1') do |p|
6
6
  p.description = "Ruby library for Parallels Virtuozzo Agent's API"
7
7
  p.url = "http://github.com/plainprograms/virtuozzo"
8
8
  p.author = "James Thompson"
data/lib/virtuozzo.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  require 'base64'
7
7
  require 'rubygems'
8
8
 
9
- require 'soap4r'
9
+ gem 'soap4r'
10
10
 
11
11
  __DIR__ = File.dirname(__FILE__)
12
12
 
@@ -4,7 +4,4 @@ module Virtuozzo # :nodoc:
4
4
 
5
5
  # Virtuozzo Agent's default system realm
6
6
  DEFAULT_REALM = '00000000-0000-0000-0000-000000000000'
7
-
8
- # UUID Generator
9
- UUID_GENERATOR = UUID.new
10
7
  end
@@ -9,6 +9,8 @@ require 'virtuozzo/soap/drivers/process_driver'
9
9
  require 'virtuozzo/soap/drivers/up2date_driver'
10
10
  require 'virtuozzo/soap/drivers/support_driver'
11
11
 
12
+ require 'soap/header/simplehandler'
13
+
12
14
  module Virtuozzo # :nodoc:
13
15
  module SOAP # :nodoc:
14
16
  # = HeaderHandler
@@ -16,7 +18,7 @@ module Virtuozzo # :nodoc:
16
18
  # Class designed to handle parsing the header region of a SOAP envelope for
17
19
  # the Virtuozzo API.
18
20
  #
19
- class HeaderHandler < SOAP::Header::SimpleHandler
21
+ class HeaderHandler < ::SOAP::Header::SimpleHandler
20
22
  NAMESPACE = 'http://www.swsoft.com/webservices/vzl/4.0.0/soap_protocol'
21
23
 
22
24
  def initialize(session = nil, target = nil)
@@ -33,7 +35,7 @@ module Virtuozzo # :nodoc:
33
35
  hdr = {}
34
36
 
35
37
  hdr.merge!({@session_elem => @session}) unless @session.nil?
36
- hdr.merge!(@target_elem => @target}) unless @target.nil? || @target == 'system'
38
+ hdr.merge!({@target_elem => @target}) unless @target.nil? || @target == 'system'
37
39
 
38
40
  return hdr
39
41
  end
@@ -45,62 +47,56 @@ module Virtuozzo # :nodoc:
45
47
  # API.
46
48
  #
47
49
  class Connection
48
- def initialize(opts = {})
49
- options = {
50
- :host => "https://localhost:4646",
51
- :username => "",
52
- :password => "",
53
- :realm => Virtuozzo::DEFAULT_REALM
54
- }.merge(opts)
55
-
56
- @endpoint = options[:host]
57
- @username = options[:username]
58
- @password = options[:pasword]
59
- @realm = options[:realm]
50
+ def initialize(host, username, password, realm = Virtuozzo::DEFAULT_REALM, debug = false)
51
+ @endpoint = host
52
+ @username = username
53
+ @password = password
54
+ @realm = realm
60
55
 
61
56
  setup_ssl_protection
57
+ setup_debug_mode if debug
62
58
  establish_session
63
59
  setup_header_handler
64
60
  end
65
61
 
66
62
  def session_driver
67
- @session_driver ||= Virtuozzo::SOAP::Drivers::SessionDriver(@endpoint)
63
+ @session_driver ||= Virtuozzo::SOAP::Drivers::SessionDriver.new(@endpoint)
68
64
  end
69
65
 
70
66
  def environment_driver
71
- @environment_driver ||= Virtuozzo::SOAP::Drivers::EnvironmentDriver(@endpoint)
67
+ @environment_driver ||= Virtuozzo::SOAP::Drivers::EnvironmentDriver.new(@endpoint)
72
68
  end
73
69
 
74
70
  def template_driver
75
- @template_driver ||= Virtuozzo::SOAP::Drivers::TemplateDriver(@endpoint)
71
+ @template_driver ||= Virtuozzo::SOAP::Drivers::TemplateDriver.new(@endpoint)
76
72
  end
77
73
 
78
74
  def relocator_driver
79
- @relocator_driver ||= Virtuozzo::SOAP::Drivers::RelocatorDriver(@endpoint)
75
+ @relocator_driver ||= Virtuozzo::SOAP::Drivers::RelocatorDriver.new(@endpoint)
80
76
  end
81
77
 
82
78
  def device_driver
83
- @device_driver ||= Virtuozzo::SOAP::Drivers::DeviceDriver(@endpoint)
79
+ @device_driver ||= Virtuozzo::SOAP::Drivers::DeviceDriver.new(@endpoint)
84
80
  end
85
81
 
86
82
  def network_driver
87
- @network_driver ||= Virtuozzo::SOAP::Drivers::NetworkDriver(@endpoint)
83
+ @network_driver ||= Virtuozzo::SOAP::Drivers::NetworkDriver.new(@endpoint)
88
84
  end
89
85
 
90
86
  def process_info_driver
91
- @process_info_driver ||= Virtuozzo::SOAP::Drivers::ProcessInfoDriver(@endpoint)
87
+ @process_info_driver ||= Virtuozzo::SOAP::Drivers::ProcessInfoDriver.new(@endpoint)
92
88
  end
93
89
 
94
90
  def process_driver
95
- @process_driver ||= Virtuozzo::SOAP::Drivers::ProcessDriver(@endpoint)
91
+ @process_driver ||= Virtuozzo::SOAP::Drivers::ProcessDriver.new(@endpoint)
96
92
  end
97
93
 
98
94
  def up2date_driver
99
- @up2date_driver ||= Virtuozzo::SOAP::Drivers::Up2dateDriver(@endpoint)
95
+ @up2date_driver ||= Virtuozzo::SOAP::Drivers::Up2dateDriver.new(@endpoint)
100
96
  end
101
97
 
102
98
  def support_driver
103
- @support_driver ||= Virtuozzo::SOAP::Drivers::SupportDriver(@endpoint)
99
+ @support_driver ||= Virtuozzo::SOAP::Drivers::SupportDriver.new(@endpoint)
104
100
  end
105
101
 
106
102
  private
@@ -119,6 +115,19 @@ module Virtuozzo # :nodoc:
119
115
  support_driver.options['protocol.http.ssl_config.verify_mode'] = nil
120
116
  end
121
117
  end
118
+
119
+ def setup_debug_mode
120
+ session_driver.wiredump_dev = STDOUT
121
+ environment_driver.wiredump_dev = STDOUT
122
+ template_driver.wiredump_dev = STDOUT
123
+ relocator_driver.wiredump_dev = STDOUT
124
+ device_driver.wiredump_dev = STDOUT
125
+ network_driver.wiredump_dev = STDOUT
126
+ process_info_driver.wiredump_dev = STDOUT
127
+ process_driver.wiredump_dev = STDOUT
128
+ up2date_driver.wiredump_dev = STDOUT
129
+ support_driver.wiredump_dev = STDOUT
130
+ end
122
131
 
123
132
  def establish_session
124
133
  login_opts = {
@@ -1038,6 +1038,19 @@ class TransferType
1038
1038
  end
1039
1039
  end
1040
1040
 
1041
+ # {http://www.swsoft.com/webservices/vzl/4.0.0/types}ip_addressType
1042
+ # ip - (any)
1043
+ # netmask - (any)
1044
+ class Ip_addressType
1045
+ attr_accessor :ip
1046
+ attr_accessor :netmask
1047
+
1048
+ def initialize(ip = nil, netmask = nil)
1049
+ @ip = ip
1050
+ @netmask = netmask
1051
+ end
1052
+ end
1053
+
1041
1054
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}system_nodeType
1042
1055
  # address - Virtuozzo::SOAP::Drivers::Device::System_nodeType::Address
1043
1056
  # login - Virtuozzo::SOAP::Drivers::Device::System_nodeType::Login
@@ -1436,19 +1449,6 @@ class Load_avg_statsType
1436
1449
  end
1437
1450
  end
1438
1451
 
1439
- # {http://www.swsoft.com/webservices/vzl/4.0.0/types}ip_addressType
1440
- # ip - (any)
1441
- # netmask - (any)
1442
- class Ip_addressType
1443
- attr_accessor :ip
1444
- attr_accessor :netmask
1445
-
1446
- def initialize(ip = nil, netmask = nil)
1447
- @ip = ip
1448
- @netmask = netmask
1449
- end
1450
- end
1451
-
1452
1452
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}env_resourceType
1453
1453
  # eid - (any)
1454
1454
  # ip_pool - Virtuozzo::SOAP::Drivers::Device::Ip_poolType
@@ -1742,6 +1742,25 @@ class Vt_settingsType_ < Vt_settingsType
1742
1742
  end
1743
1743
  end
1744
1744
 
1745
+ # {http://www.swsoft.com/webservices/vzl/4.0.0/types}groupType
1746
+ # user - Virtuozzo::SOAP::Drivers::Device::GroupType::User
1747
+ # member_group - Virtuozzo::SOAP::Drivers::Device::GroupType::Member_group
1748
+ # name - SOAP::SOAPString
1749
+ # gid - SOAP::SOAPInt
1750
+ class GroupType
1751
+ attr_accessor :user
1752
+ attr_accessor :member_group
1753
+ attr_accessor :name
1754
+ attr_accessor :gid
1755
+
1756
+ def initialize(user = [], member_group = [], name = nil, gid = nil)
1757
+ @user = user
1758
+ @member_group = member_group
1759
+ @name = name
1760
+ @gid = gid
1761
+ end
1762
+ end
1763
+
1745
1764
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}userType
1746
1765
  # initial_group - Virtuozzo::SOAP::Drivers::Device::UserType::Initial_group
1747
1766
  # group - Virtuozzo::SOAP::Drivers::Device::UserType::Group
@@ -1802,13 +1821,7 @@ class UserType
1802
1821
  end
1803
1822
  end
1804
1823
 
1805
- # {http://www.swsoft.com/webservices/vzl/4.0.0/types}groupType
1806
- # user - Virtuozzo::SOAP::Drivers::Device::GroupType::User
1807
- # member_group - Virtuozzo::SOAP::Drivers::Device::GroupType::Member_group
1808
- # name - SOAP::SOAPString
1809
- # gid - SOAP::SOAPInt
1810
1824
  class GroupType
1811
-
1812
1825
  # inner class for member: user
1813
1826
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}user
1814
1827
  # name - SOAP::SOAPString
@@ -1830,18 +1843,6 @@ class GroupType
1830
1843
  @name = name
1831
1844
  end
1832
1845
  end
1833
-
1834
- attr_accessor :user
1835
- attr_accessor :member_group
1836
- attr_accessor :name
1837
- attr_accessor :gid
1838
-
1839
- def initialize(user = [], member_group = [], name = nil, gid = nil)
1840
- @user = user
1841
- @member_group = member_group
1842
- @name = name
1843
- @gid = gid
1844
- end
1845
1846
  end
1846
1847
 
1847
1848
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}packageType
@@ -104,8 +104,8 @@ module Virtuozzo
104
104
  def initialize(endpoint_url = nil)
105
105
  endpoint_url ||= DefaultEndpointUrl
106
106
  super(endpoint_url, nil)
107
- self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
108
- self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
107
+ self.mapping_registry = Virtuozzo::SOAP::Drivers::Device::DefaultMappingRegistry::EncodedRegistry
108
+ self.literal_mapping_registry = Virtuozzo::SOAP::Drivers::Device::DefaultMappingRegistry::LiteralRegistry
109
109
  init_methods
110
110
  end
111
111
 
@@ -600,6 +600,19 @@ class TransferType
600
600
  end
601
601
  end
602
602
 
603
+ # {http://www.swsoft.com/webservices/vzl/4.0.0/types}ip_addressType
604
+ # ip - (any)
605
+ # netmask - (any)
606
+ class Ip_addressType
607
+ attr_accessor :ip
608
+ attr_accessor :netmask
609
+
610
+ def initialize(ip = nil, netmask = nil)
611
+ @ip = ip
612
+ @netmask = netmask
613
+ end
614
+ end
615
+
603
616
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}system_nodeType
604
617
  # address - Virtuozzo::SOAP::Drivers::Environment::System_nodeType::Address
605
618
  # login - Virtuozzo::SOAP::Drivers::Environment::System_nodeType::Login
@@ -998,19 +1011,6 @@ class Load_avg_statsType
998
1011
  end
999
1012
  end
1000
1013
 
1001
- # {http://www.swsoft.com/webservices/vzl/4.0.0/types}ip_addressType
1002
- # ip - (any)
1003
- # netmask - (any)
1004
- class Ip_addressType
1005
- attr_accessor :ip
1006
- attr_accessor :netmask
1007
-
1008
- def initialize(ip = nil, netmask = nil)
1009
- @ip = ip
1010
- @netmask = netmask
1011
- end
1012
- end
1013
-
1014
1014
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}env_resourceType
1015
1015
  # eid - (any)
1016
1016
  # ip_pool - Virtuozzo::SOAP::Drivers::Environment::Ip_poolType
@@ -1304,6 +1304,25 @@ class Vt_settingsType_ < Vt_settingsType
1304
1304
  end
1305
1305
  end
1306
1306
 
1307
+ # {http://www.swsoft.com/webservices/vzl/4.0.0/types}groupType
1308
+ # user - Virtuozzo::SOAP::Drivers::Environment::GroupType::User
1309
+ # member_group - Virtuozzo::SOAP::Drivers::Environment::GroupType::Member_group
1310
+ # name - SOAP::SOAPString
1311
+ # gid - SOAP::SOAPInt
1312
+ class GroupType
1313
+ attr_accessor :user
1314
+ attr_accessor :member_group
1315
+ attr_accessor :name
1316
+ attr_accessor :gid
1317
+
1318
+ def initialize(user = [], member_group = [], name = nil, gid = nil)
1319
+ @user = user
1320
+ @member_group = member_group
1321
+ @name = name
1322
+ @gid = gid
1323
+ end
1324
+ end
1325
+
1307
1326
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}userType
1308
1327
  # initial_group - Virtuozzo::SOAP::Drivers::Environment::UserType::Initial_group
1309
1328
  # group - Virtuozzo::SOAP::Drivers::Environment::UserType::Group
@@ -1364,13 +1383,7 @@ class UserType
1364
1383
  end
1365
1384
  end
1366
1385
 
1367
- # {http://www.swsoft.com/webservices/vzl/4.0.0/types}groupType
1368
- # user - Virtuozzo::SOAP::Drivers::Environment::GroupType::User
1369
- # member_group - Virtuozzo::SOAP::Drivers::Environment::GroupType::Member_group
1370
- # name - SOAP::SOAPString
1371
- # gid - SOAP::SOAPInt
1372
1386
  class GroupType
1373
-
1374
1387
  # inner class for member: user
1375
1388
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}user
1376
1389
  # name - SOAP::SOAPString
@@ -1392,18 +1405,6 @@ class GroupType
1392
1405
  @name = name
1393
1406
  end
1394
1407
  end
1395
-
1396
- attr_accessor :user
1397
- attr_accessor :member_group
1398
- attr_accessor :name
1399
- attr_accessor :gid
1400
-
1401
- def initialize(user = [], member_group = [], name = nil, gid = nil)
1402
- @user = user
1403
- @member_group = member_group
1404
- @name = name
1405
- @gid = gid
1406
- end
1407
1408
  end
1408
1409
 
1409
1410
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}packageType
@@ -2733,12 +2734,11 @@ class Vzaenvm_configurationType < Envm_configurationType
2733
2734
  attr_accessor :sve_visible
2734
2735
  attr_accessor :timeouts
2735
2736
 
2736
- def initialize(timeouts = nil, start_veid = nil, end_veid = nil, sve_visible = nil, timeouts = nil)
2737
+ def initialize(timeouts = nil, start_veid = nil, end_veid = nil, sve_visible = nil)
2737
2738
  @timeouts = timeouts
2738
2739
  @start_veid = start_veid
2739
2740
  @end_veid = end_veid
2740
2741
  @sve_visible = sve_visible
2741
- @timeouts = timeouts
2742
2742
  end
2743
2743
  end
2744
2744
 
@@ -264,8 +264,8 @@ module Virtuozzo # :nodoc:
264
264
  def initialize(endpoint_url = nil)
265
265
  endpoint_url ||= DefaultEndpointUrl
266
266
  super(endpoint_url, nil)
267
- self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
268
- self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
267
+ self.mapping_registry = Virtuozzo::SOAP::Drivers::Environment::DefaultMappingRegistry::EncodedRegistry
268
+ self.literal_mapping_registry = Virtuozzo::SOAP::Drivers::Environment::DefaultMappingRegistry::LiteralRegistry
269
269
  init_methods
270
270
  end
271
271
 
@@ -296,5 +296,6 @@ module Virtuozzo # :nodoc:
296
296
  end
297
297
  end
298
298
 
299
-
300
- end
299
+ end
300
+ end
301
+ end
@@ -390,6 +390,19 @@ class TransferType
390
390
  end
391
391
  end
392
392
 
393
+ # {http://www.swsoft.com/webservices/vzl/4.0.0/types}ip_addressType
394
+ # ip - (any)
395
+ # netmask - (any)
396
+ class Ip_addressType
397
+ attr_accessor :ip
398
+ attr_accessor :netmask
399
+
400
+ def initialize(ip = nil, netmask = nil)
401
+ @ip = ip
402
+ @netmask = netmask
403
+ end
404
+ end
405
+
393
406
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}system_nodeType
394
407
  # address - Virtuozzo::SOAP::Drivers::Network::System_nodeType::Address
395
408
  # login - Virtuozzo::SOAP::Drivers::Network::System_nodeType::Login
@@ -788,19 +801,6 @@ class Load_avg_statsType
788
801
  end
789
802
  end
790
803
 
791
- # {http://www.swsoft.com/webservices/vzl/4.0.0/types}ip_addressType
792
- # ip - (any)
793
- # netmask - (any)
794
- class Ip_addressType
795
- attr_accessor :ip
796
- attr_accessor :netmask
797
-
798
- def initialize(ip = nil, netmask = nil)
799
- @ip = ip
800
- @netmask = netmask
801
- end
802
- end
803
-
804
804
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}env_resourceType
805
805
  # eid - (any)
806
806
  # ip_pool - Virtuozzo::SOAP::Drivers::Network::Ip_poolType
@@ -1038,6 +1038,26 @@ class Vt_settingsType
1038
1038
  end
1039
1039
  end
1040
1040
 
1041
+ # {http://www.swsoft.com/webservices/vzl/4.0.0/types}groupType
1042
+ # user - Virtuozzo::SOAP::Drivers::Network::GroupType::User
1043
+ # member_group - Virtuozzo::SOAP::Drivers::Network::GroupType::Member_group
1044
+ # name - SOAP::SOAPString
1045
+ # gid - SOAP::SOAPInt
1046
+ class GroupType
1047
+ attr_accessor :user
1048
+ attr_accessor :member_group
1049
+ attr_accessor :name
1050
+ attr_accessor :gid
1051
+
1052
+ def initialize(user = [], member_group = [], name = nil, gid = nil)
1053
+ @user = user
1054
+ @member_group = member_group
1055
+ @name = name
1056
+ @gid = gid
1057
+ end
1058
+ end
1059
+
1060
+
1041
1061
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}userType
1042
1062
  # initial_group - Virtuozzo::SOAP::Drivers::Network::UserType::Initial_group
1043
1063
  # group - Virtuozzo::SOAP::Drivers::Network::UserType::Group
@@ -1098,11 +1118,6 @@ class UserType
1098
1118
  end
1099
1119
  end
1100
1120
 
1101
- # {http://www.swsoft.com/webservices/vzl/4.0.0/types}groupType
1102
- # user - Virtuozzo::SOAP::Drivers::Network::GroupType::User
1103
- # member_group - Virtuozzo::SOAP::Drivers::Network::GroupType::Member_group
1104
- # name - SOAP::SOAPString
1105
- # gid - SOAP::SOAPInt
1106
1121
  class GroupType
1107
1122
 
1108
1123
  # inner class for member: user
@@ -1126,18 +1141,6 @@ class GroupType
1126
1141
  @name = name
1127
1142
  end
1128
1143
  end
1129
-
1130
- attr_accessor :user
1131
- attr_accessor :member_group
1132
- attr_accessor :name
1133
- attr_accessor :gid
1134
-
1135
- def initialize(user = [], member_group = [], name = nil, gid = nil)
1136
- @user = user
1137
- @member_group = member_group
1138
- @name = name
1139
- @gid = gid
1140
- end
1141
1144
  end
1142
1145
 
1143
1146
  # {http://www.swsoft.com/webservices/vzl/4.0.0/types}packageType