azure 0.6.3 → 0.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.txt +7 -0
  3. data/README.md +52 -35
  4. data/lib/azure/base_management/management_http_request.rb +1 -1
  5. data/lib/azure/cloud_service_management/cloud_service.rb +1 -1
  6. data/lib/azure/cloud_service_management/cloud_service_management_service.rb +8 -10
  7. data/lib/azure/cloud_service_management/serialization.rb +9 -8
  8. data/lib/azure/storage_management/storage_management_service.rb +2 -2
  9. data/lib/azure/version.rb +1 -1
  10. data/lib/azure/virtual_machine_image_management/serialization.rb +4 -6
  11. data/lib/azure/virtual_machine_image_management/virtual_machine_disk.rb +0 -2
  12. data/lib/azure/virtual_machine_image_management/virtual_machine_image.rb +0 -2
  13. data/lib/azure/virtual_machine_image_management/virtual_machine_image_management_service.rb +4 -9
  14. data/lib/azure/virtual_machine_management/serialization.rb +19 -4
  15. data/lib/azure/virtual_machine_management/virtual_machine.rb +1 -0
  16. data/lib/azure/virtual_machine_management/virtual_machine_management_service.rb +118 -68
  17. data/test/integration/cloud_service/Cloud_Create_test.rb +44 -0
  18. data/test/integration/cloud_service/Cloud_Delete_test.rb +44 -0
  19. data/test/integration/vm/VM_Create_test.rb +56 -10
  20. data/test/integration/vm/VM_Operations_test.rb +3 -4
  21. data/test/unit/cloud_service_management/cloud_service_management_service_test.rb +30 -30
  22. data/test/unit/cloud_service_management/serialization_test.rb +20 -20
  23. data/test/unit/virtual_machine_image_management/serialization_test.rb +6 -6
  24. data/test/unit/virtual_machine_image_management/virtual_machine_image_management_service_test.rb +20 -20
  25. data/test/unit/virtual_machine_management/serialization_test.rb +26 -14
  26. data/test/unit/virtual_machine_management/virtual_machine_management_service_test.rb +80 -75
  27. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 184071aad7a3c42ae4096da3d27aaadf01f5dd42
4
- data.tar.gz: 2b8f026ba119dda6324cbaeb1c0c0857dade93b8
3
+ metadata.gz: 04ded6fcb137549c13dbcb6a6a9edd6ef8984425
4
+ data.tar.gz: caa3fbe95aed896613b2e0fbf393fee2db4d49e7
5
5
  SHA512:
6
- metadata.gz: d73a29abe2a26c39630977cce42d940cc1d15b9c12eeb87aeb8cf880427691e5952e85798ad47488b0ccd8f36c8f41648bc40febe0ea32506ba78b739cd47d68
7
- data.tar.gz: ed70f72f78035c46141b33d56a7b1611fd610e8c1a2eab44c944c11d78c4062006e8b8915f425c007e48402b4bdfb78c77093c8bdf7dc30979c3916a6f85d9b4
6
+ metadata.gz: 6cd3141f9ecf5892a7537f5fc5d85a0495caf6ae135a1eca6bec1be900d638056e44dd40aef8c44bb858cbb916c8a7d63fa6a031e36c41ff2fea7dcbdab350d3
7
+ data.tar.gz: 0dea6a1183c5e1bb238351c6f9bcd0de7f6a4cf149d8ad3c8d7debb213430ebc73b538f9ef0d42f2950007a1005468eff39247ed2fc11f5533b60e3a6559e49b
@@ -1,3 +1,10 @@
1
+ 2014.05.06 - version 0.6.4
2
+ * Upgraded Service Management Versioning to 2014-04-01
3
+ * Created separate API for add role
4
+ * Logical Unit Number(lun) is optional argument in API add_data_disk
5
+ * Cloud service should delete only if there are no other VMs/Deployments in the cloud service
6
+ * Added more sizes(Basic_A0, Basic_A1, Basic_A2, Basic_A3, Basic_A4) options for Virtual Machine and Cloud Service.
7
+
1
8
  2014.03.28 - version 0.6.3
2
9
  * Added get_cloud_service_properties method, which returns all cloud service properties (embed-detail=true), including info about all VMs
3
10
  * Added winrm_http_port and winrm_https_port to get_virtual_machine method to allow the users to configure custom ports for winrm-http and winrm-https
data/README.md CHANGED
@@ -1,7 +1,8 @@
1
- # Windows Azure SDK for Ruby [![Build Status](https://travis-ci.org/WindowsAzure/azure-sdk-for-ruby.png?branch=dev)](https://travis-ci.org/WindowsAzure/azure-sdk-for-ruby)
1
+ # Microsoft Azure SDK for Ruby
2
+ [![Build Status](https://travis-ci.org/Azure/azure-sdk-for-ruby.png?branch=dev)](https://travis-ci.org/Azure/azure-sdk-for-ruby)
2
3
 
3
4
 
4
- This project provides a Ruby package that makes it easy to access and manage Windows Azure Services like Storage, Service Bus and Virtual Machines.
5
+ This project provides a Ruby package that makes it easy to access and manage Microsoft Azure Services like Storage, Service Bus and Virtual Machines.
5
6
 
6
7
  # Library Features
7
8
  * Storage
@@ -25,23 +26,23 @@ This project provides a Ruby package that makes it easy to access and manage Win
25
26
  * create, list, and delete subscriptions
26
27
  * create, list, and delete rules
27
28
  * Base Management
28
- * list locations
29
+ * list locations
29
30
  * get, list, create, update, delete affinity groups
30
31
  * Virtual Machine Management
31
32
  * list images
32
- * list, delete Disks
33
+ * list, delete Disks
33
34
  * Virtual Machines
34
- * create linux based VMs and ssh with cert and key option enabled for ssh and WINRM (both http & https)enabled for windows based VMs
35
- * list, shut down, delete, find virtual machine deployments. While shutting down your VMs the provisioning state would be deallocated and this VM will not be included in the billing cycle.
36
- * Create VM for a specific virtual network
35
+ * create linux based VMs and ssh with cert and key option enabled for ssh and WINRM (both http & https)enabled for windows based VMs
36
+ * list, shut down, delete, find virtual machine deployments. While shutting down your VMs the provisioning state would be deallocated and this VM will not be included in the billing cycle.
37
+ * Create VM for a specific virtual network
37
38
  * Cloud Service Management
38
39
  * create, list, delete cloud services
39
40
  * Storage Account Management
40
41
  * create, list storage accounts, list locations
41
42
  * SQL Database Server Management
42
- * list, create SQL Database servers
43
- * reset password for a SQL Database server
44
- * list, set, delete firewall rules for a SQL Database server
43
+ * list, create SQL Database servers
44
+ * reset password for a SQL Database server
45
+ * list, set, delete firewall rules for a SQL Database server
45
46
  * Virtual Network Management
46
47
  * List VNet
47
48
  * Create VNet via parameters or xml file
@@ -68,7 +69,7 @@ gem install azure
68
69
  To get the source code of the SDK via **git** just type:
69
70
 
70
71
  ```bash
71
- git clone https://github.com/WindowsAzure/azure-sdk-for-ruby.git
72
+ git clone https://github.com/Azure/azure-sdk-for-ruby.git
72
73
  cd ./azure-sdk-for-ruby
73
74
  ```
74
75
  Then, run bundler to install all the gem dependencies:
@@ -83,7 +84,7 @@ Running the command ``rdoc`` will generate the API documentation in the `./doc`
83
84
 
84
85
  ## Setup Connection
85
86
 
86
- You can use this SDK against the Windows Azure Services in the cloud, or against the local Storage Emulator if you are on Windows. Service Bus and Windows Azure Service Management emulation are not supported. Of course, to use the Windows Azure Services in the cloud, you need to first [create a Windows Azure account](http://www.windowsazure.com/en-us/pricing/free-trial/). After that, you can get the information you need to configure Storage and Service Bus from the [Windows Azure Portal](https://manage.windowsazure.com).
87
+ You can use this SDK against the Microsoft Azure Services in the cloud, or against the local Storage Emulator if you are on Windows. Service Bus and Microsoft Azure Service Management emulation are not supported. Of course, to use the Microsoft Azure Services in the cloud, you need to first [create a Microsoft Azure account](http://www.windowsazure.com/en-us/pricing/free-trial/). After that, you can get the information you need to configure Storage and Service Bus from the [Microsoft Azure Portal](https://manage.windowsazure.com).
87
88
 
88
89
  There are two ways you can set up the connections:
89
90
 
@@ -91,7 +92,7 @@ There are two ways you can set up the connections:
91
92
  2. [via environment variables](#via-environment-variables)
92
93
 
93
94
  ### Via Code
94
- * Against Windows Azure Services in the cloud
95
+ * Against Microsoft Azure Services in the cloud
95
96
 
96
97
  ```ruby
97
98
  require "azure"
@@ -130,7 +131,7 @@ There are two ways you can set up the connections:
130
131
  end
131
132
  ```
132
133
  ### Via Environment Variables
133
- * Against Windows Azure Services in the cloud
134
+ * Against Microsoft Azure Services in the cloud
134
135
  * Storage
135
136
 
136
137
  ```bash
@@ -149,7 +150,7 @@ There are two ways you can set up the connections:
149
150
  ```bash
150
151
  AZURE_MANAGEMENT_CERTIFICATE = <path to *.pem or *.pfx>
151
152
  AZURE_SUBSCRIPTION_ID = <your subscription ID>
152
- AZURE_MANAGEMENT_ENDPOINT = <The endpoint URL of Windows Azure management service>
153
+ AZURE_MANAGEMENT_ENDPOINT = <The endpoint URL of Microsoft Azure management service>
153
154
  AZURE_SQL_DATABASE_MANAGEMENT_ENDPOINT = <SQL Database Management Endpoint>
154
155
  AZURE_SQL_DATABASE_AUTHENTICATION_MODE = <:management_certificate or :sql_server>
155
156
  ```
@@ -171,7 +172,7 @@ You can use the following commands to run:
171
172
  * a specific suite of tests: ``rake test:integration:blob``
172
173
  * one particular test file: ``ruby -I"lib:test" "<path of the test file>"``
173
174
  # Usage
174
- **For more examples, please see the [Windows Azure Ruby Developer Center](http://www.windowsazure.com/en-us/develop/ruby)**
175
+ **For more examples, please see the [Microsoft Azure Ruby Developer Center](http://www.windowsazure.com/en-us/develop/ruby)**
175
176
  ## Storage
176
177
 
177
178
  ### Blobs
@@ -373,13 +374,13 @@ virtual_machine_service.start_virtual_machine('vm_name', 'cloud_service_name')
373
374
  virtual_machine_service.restart_virtual_machine('vm_name', 'cloud_service_name')
374
375
 
375
376
  #API for add disk to Virtual Machine
376
- lun = 1 #Valid LUN values are 0 through 15.
377
377
  options = {
378
378
  :disk_label => 'disk-label',
379
379
  :disk_size => 100, #In GB
380
- :import => false
380
+ :import => false,
381
+ :disk_name => 'Disk name' #Required when import is true
381
382
  }
382
- virtual_machine_service.add_data_disk('vm_name', 'cloud_service_name', lun, options)
383
+ virtual_machine_service.add_data_disk('vm_name', 'cloud_service_name', options)
383
384
 
384
385
  #API to add/update Virtual Machine endpoints
385
386
  endpoint1 = {
@@ -421,19 +422,35 @@ options = {
421
422
  :private_key_file => 'c:/private_key.key', #required for ssh or winrm(https) certificate.
422
423
  :certificate_file => 'c:/certificate.pem', #required for ssh or winrm(https) certificate.
423
424
  :ssh_port => 2222,
424
- :vm_size => 'Small', #valid choices are (ExtraSmall, Small, Medium, Large, ExtraLarge, A6, A7)
425
+ :vm_size => 'Small', #valid choices are (ExtraSmall Small Medium Large ExtraLarge A5 A6 A7 Basic_A0 Basic_A1 Basic_A2 Basic_A3 Basic_A4)
425
426
  :affinity_group_name => 'affinity1',
426
427
  :virtual_network_name => 'xplattestvnet',
427
428
  :subnet_name => 'subnet1',
428
429
  :availability_set_name => 'availabiltyset1'
429
430
  }
430
- virtual_machine_service.create_virtual_machine(params,options,add_role=false)
431
- # Here add_role is used as a flag to create multiple roles under the same cloud service. This parameter is false
432
- # by default. Atleast a single deployment should be created under a hosted service prior to setting this flag.
431
+ virtual_machine_service.create_virtual_machine(params,options)
433
432
 
434
433
  #API usage to add new roles under cloud service creating VM
435
-
436
- virtual_machine_service.create_virtual_machine(params,options,add_role=true)
434
+ #API add_role create multiple roles under the same cloud service. Atleast a single deployment should be created under a hosted service.
435
+ params = {
436
+ :vm_name => 'vm_name',
437
+ :cloud_service_name => 'cloud_service_name',
438
+ :vm_user => 'azureuser',
439
+ :image => 'a699494373c04fc0bc8f2bb1389d6106__Win2K8R2SP1-Datacenter-201305.01-en.us-127GB.vhd',
440
+ :password => 'ComplexPassword',
441
+ }
442
+ options = {
443
+ :storage_account_name => 'storage_suse',
444
+ :winrm_transport => ['https','http'], #Currently http is supported. To enable https, set the transport protocol to https, simply rdp to the VM once VM is in ready state, export the certificate ( CN name would be the deployment name) from the certstore of the VM and install to your local machine and communicate WinRM via https.
445
+ :tcp_endpoints => '80,3389:3390',
446
+ :private_key_file => 'c:/private_key.key', #required for ssh or winrm(https) certificate.
447
+ :certificate_file => 'c:/certificate.pem', #required for ssh or winrm(https) certificate.
448
+ :winrm_https_port => 5999,
449
+ :winrm_http_port => 6999, #Used to open different powershell port
450
+ :vm_size => 'Small', #valid choices are (ExtraSmall Small Medium Large ExtraLarge A5 A6 A7 Basic_A0 Basic_A1 Basic_A2 Basic_A3 Basic_A4)
451
+ :availability_set_name => 'availabiltyset'
452
+ }
453
+ virtual_machine_service.add_role(params, options)
437
454
 
438
455
  #Get a list of available virtual machine images
439
456
  virtual_machine_image_service = Azure::VirtualMachineImageManagementService.new
@@ -508,7 +525,7 @@ ip_range = {:start_ip_address => "0.0.0.1", :end_ip_address => "0.0.0.5"}
508
525
  sql_db_service.set_sql_server_firewall_rule("server-name", "rule-name", ip_range)
509
526
 
510
527
  # If ip_range was not specified in the above api then the IP of the machine from where the api is being called would be set as the rule.
511
- # To toggle between the option to allow windows azure services to access db server similar to azure portal just set the fire wall rule
528
+ # To toggle between the option to allow Microsoft Azure services to access db server similar to azure portal just set the fire wall rule
512
529
  # with iprange to be 0.0.0.0 as start and end.Remove the rule to unset this option.
513
530
  ```
514
531
  ## Virtual Network Management
@@ -551,23 +568,23 @@ Currently the sdk supports *.pem or *.pfx (passwordless pfx) for service managem
551
568
  * To create pfx, simply download the publishsettings file for your subscription, copy the contents of Management Certificate from the publishsettings and save it in a file and name the file as your cert.pfx. This pfx will be a passwordless pfx which can be supplied as a cert parameter for Service Management Commands
552
569
  * Using the following openssl commands to extract the pem file and pass the pem file as management cert parameter.
553
570
  * To get only private key from pfx use Openssl.exe pkcs12 -in cert.pfx -nocerts -out cert.pem
554
- * To remove passphrase from the above private key use ``Openssl.exe rsa -in cert.pem -out certprivnopassword.pem``
555
- * To extract both public & private keys from pfx use ``Openssl.exe pkcs12 -in cert.pfx -out certprivpub.pem``
556
- * To extract only public key from pem use ``Openssl.exe x509 -inform pem -in certprivpub.pem -pubkey -out certpub.pem -outform pem``
571
+ * To remove passphrase from the above private key use ``Openssl.exe rsa -in cert.pem -out certprivnopassword.pem``
572
+ * To extract both public & private keys from pfx use ``Openssl.exe pkcs12 -in cert.pfx -out certprivpub.pem``
573
+ * To extract only public key from pem use ``Openssl.exe x509 -inform pem -in certprivpub.pem -pubkey -out certpub.pem -outform pem``
557
574
  * Finally copy the public key & private key to a file *.pem and pass that pem file to management cert parameter.
558
575
  * To extract pem from custom certificate, export the pfx, follow the above steps to convert to pem and pass that pem file to management cert parameter.
559
576
 
560
577
  # Need Help?
561
578
 
562
- Be sure to check out the Windows Azure [Developer Forums on Stack Overflow and MSDN](http://go.microsoft.com/fwlink/?LinkId=234489) if you have trouble with the provided code.
579
+ Be sure to check out the Microsoft Azure [Developer Forums on Stack Overflow and MSDN](http://go.microsoft.com/fwlink/?LinkId=234489) if you have trouble with the provided code.
563
580
 
564
581
  # Contribute Code or Provide Feedback
565
582
 
566
- If you would like to become an active contributor to this project please follow the instructions provided in [Windows Azure Projects Contribution Guidelines](http://windowsazure.github.com/guidelines.html).
567
- If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/WindowsAzure/azure-sdk-for-ruby/issues) section of the project.
583
+ If you would like to become an active contributor to this project please follow the instructions provided in [Microsoft Azure Projects Contribution Guidelines](http://windowsazure.github.com/guidelines.html).
584
+ If you encounter any bugs with the library please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-ruby/issues) section of the project.
568
585
 
569
586
  # Learn More
570
587
 
571
- For documentation on how to host Ruby applications on Windows Azure, please see the [Windows Azure Ruby Developer Center](http://www.windowsazure.com/en-us/develop/ruby/).
572
- For documentation on Azure PowerShell CLI tool for Windows, please see our readme [here](http://github.com/windowsazure/azure-sdk-tools).
573
- For documentation on the Azure cross platform CLI tool for Windows, Mac and Linux, please see our readme [here](http://github.com/windowsazure/azure-sdk-tools-xplat).
588
+ For documentation on how to host Ruby applications on Microsoft Azure, please see the [Microsoft Azure Ruby Developer Center](http://www.windowsazure.com/en-us/develop/ruby/).
589
+ For documentation on Azure PowerShell CLI tool for Windows, please see our readme [here](http://github.com/azure/azure-sdk-tools).
590
+ For documentation on the Azure cross platform CLI tool for Windows, Mac and Linux, please see our readme [here](http://github.com/azure/azure-sdk-tools-xplat).
@@ -35,7 +35,7 @@ module Azure
35
35
  @warn = false
36
36
  content_length = body ? body.bytesize.to_s : '0'
37
37
  @headers = {
38
- 'x-ms-version' => '2013-06-01',
38
+ 'x-ms-version' => '2014-04-01',
39
39
  'Content-Type' => 'application/xml',
40
40
  'Content-Length' => content_length
41
41
  }
@@ -16,7 +16,6 @@
16
16
  module Azure
17
17
  module CloudServiceManagement
18
18
  class CloudService
19
-
20
19
  def initialize
21
20
  yield self if block_given?
22
21
  end
@@ -33,6 +32,7 @@ module Azure
33
32
  attr_accessor :extended_properties
34
33
  attr_accessor :default_winrm_certificate_thumbprint
35
34
  attr_accessor :virtual_machines
35
+ attr_accessor :deployment_name
36
36
  end
37
37
  end
38
38
  end
@@ -17,7 +17,6 @@ require 'azure/cloud_service_management/serialization'
17
17
  module Azure
18
18
  module CloudServiceManagement
19
19
  class CloudServiceManagementService < BaseManagementService
20
-
21
20
  def initialize
22
21
  super()
23
22
  end
@@ -48,12 +47,12 @@ module Azure
48
47
  #
49
48
  # Returns None
50
49
  def create_cloud_service(name, options = {})
51
- Loggerx.error_with_exit "Cloud service name is not valid " unless name
50
+ Loggerx.error_with_exit 'Cloud service name is not valid ' unless name
52
51
  if get_cloud_service(name)
53
52
  Loggerx.warn "Cloud service #{name} already exists. Skipped..."
54
53
  else
55
54
  Loggerx.info "Creating cloud service #{name}."
56
- request_path = "/services/hostedservices"
55
+ request_path = '/services/hostedservices'
57
56
  body = Serialization.cloud_services_to_xml(name, options)
58
57
  request = ManagementHttpRequest.new(:post, request_path, body)
59
58
  request.call
@@ -64,7 +63,7 @@ module Azure
64
63
  #
65
64
  # Returns an array of Azure::CloudServiceManagement::CloudService objects
66
65
  def list_cloud_services
67
- request_path = "/services/hostedservices"
66
+ request_path = '/services/hostedservices'
68
67
  request = ManagementHttpRequest.new(:get, request_path, nil)
69
68
  response = request.call
70
69
  Serialization.cloud_services_from_xml(response)
@@ -95,7 +94,7 @@ module Azure
95
94
  request_path = "/services/hostedservices/#{name}?embed-detail=true"
96
95
  request = ManagementHttpRequest.new(:get, request_path)
97
96
  response = request.call
98
- Serialization.cloud_services_from_xml(response)
97
+ Serialization.cloud_services_from_xml(response).first
99
98
  end
100
99
 
101
100
  # Public: Deletes the specified cloud service of given subscription id from Windows Azure.
@@ -106,7 +105,7 @@ module Azure
106
105
  #
107
106
  # Returns: None
108
107
  def delete_cloud_service(cloud_service_name)
109
- request_path= "/services/hostedservices/#{cloud_service_name}"
108
+ request_path = "/services/hostedservices/#{cloud_service_name}"
110
109
  request = ManagementHttpRequest.new(:delete, request_path)
111
110
  Loggerx.info "Deleting cloud service #{cloud_service_name}. \n"
112
111
  request.call
@@ -122,7 +121,7 @@ module Azure
122
121
  #
123
122
  # Returns NONE
124
123
  def delete_cloud_service_deployment(cloud_service_name)
125
- request_path= "/services/hostedservices/#{cloud_service_name}/deploymentslots/production"
124
+ request_path = "/services/hostedservices/#{cloud_service_name}/deploymentslots/production"
126
125
  request = ManagementHttpRequest.new(:delete, request_path)
127
126
  Loggerx.info "Deleting deployment of cloud service \"#{cloud_service_name}\" ..."
128
127
  request.call
@@ -130,13 +129,12 @@ module Azure
130
129
 
131
130
  def upload_certificate(cloud_service_name, ssh)
132
131
  data = export_der(ssh[:cert], ssh[:key])
133
- request_path= "/services/hostedservices/#{cloud_service_name}/certificates"
132
+ request_path = "/services/hostedservices/#{cloud_service_name}/certificates"
134
133
  body = Serialization.add_certificate_to_xml(data)
135
134
  Loggerx.info "Uploading certificate to cloud service #{cloud_service_name}..."
136
135
  request = ManagementHttpRequest.new(:post, request_path, body)
137
136
  request.call
138
137
  end
139
-
140
138
  end
141
139
  end
142
- end
140
+ end
@@ -66,8 +66,10 @@ module Azure
66
66
 
67
67
  cloud.label = Base64.decode64(xml_content(props_xml, 'Label'))
68
68
  cloud.description = xml_content(props_xml, 'Description')
69
- cloud.location = xml_content(props_xml, 'Location')
70
- cloud.affinity_group = xml_content(props_xml, 'AffinityGroup')
69
+ location = xml_content(props_xml, 'Location')
70
+ cloud.location = location unless location.empty?
71
+ affinity_group = xml_content(props_xml, 'AffinityGroup')
72
+ cloud.affinity_group = affinity_group unless affinity_group
71
73
  cloud.status = xml_content(props_xml, 'Status')
72
74
  cloud.date_created = xml_content(props_xml, 'DateCreated')
73
75
  cloud.date_modified = xml_content(props_xml, 'DateLastModified')
@@ -82,7 +84,8 @@ module Azure
82
84
  cloud.default_winrm_certificate_thumbprint = xml_content(
83
85
  cloud_service_xml, 'DefaultWinRMCertificateThumbprint'
84
86
  )
85
-
87
+ deployment_xml = cloud_services_xml.css('Deployments Deployment')
88
+ cloud.deployment_name = xml_content(deployment_xml, 'Name')
86
89
  vms_in_deployment = {}
87
90
 
88
91
  cloud_service_xml.css('Deployments').each do |deployxml|
@@ -90,8 +93,7 @@ module Azure
90
93
  vms = Azure::VirtualMachineManagement::Serialization.virtual_machines_from_xml(
91
94
  deployxml, cloud.name
92
95
  )
93
-
94
- vms_in_deployment[deployment_name.to_sym] = vms
96
+ vms_in_deployment[deployment_name.to_sym] = vms if vms
95
97
  end
96
98
 
97
99
  cloud.virtual_machines = vms_in_deployment
@@ -102,15 +104,14 @@ module Azure
102
104
 
103
105
  def self.add_certificate_to_xml(data)
104
106
  builder = Nokogiri::XML::Builder.new do |xml|
105
- xml.CertificateFile('xmlns'=>'http://schemas.microsoft.com/windowsazure') {
107
+ xml.CertificateFile('xmlns' => 'http://schemas.microsoft.com/windowsazure') do
106
108
  xml.Data data
107
109
  xml.CertificateFormat 'pfx'
108
110
  xml.Password nil
109
- }
111
+ end
110
112
  end
111
113
  builder.doc.to_xml
112
114
  end
113
-
114
115
  end
115
116
  end
116
117
  end
@@ -55,13 +55,13 @@ module Azure
55
55
  end
56
56
 
57
57
  # Public: Gets the properties of the storage account specified.
58
- #
58
+ #
59
59
  # ==== Attributes
60
60
  #
61
61
  # * +name+ - String. The name of the storage account. Required.
62
62
  #
63
63
  # See http://msdn.microsoft.com/en-us/library/windowsazure/ee460802.aspx
64
- #
64
+ #
65
65
  # Returns the storage account
66
66
  def get_storage_account_properties(name)
67
67
  request_path = "/services/storageservices/#{name}"
@@ -17,7 +17,7 @@ module Azure
17
17
  class Version
18
18
  MAJOR = 0 unless defined? MAJOR
19
19
  MINOR = 6 unless defined? MINOR
20
- UPDATE = 3 unless defined? UPDATE
20
+ UPDATE = 4 unless defined? UPDATE
21
21
  PRE = nil unless defined? PRE
22
22
 
23
23
  class << self
@@ -18,9 +18,8 @@ require 'azure/virtual_machine_image_management/virtual_machine_disk'
18
18
  module Azure
19
19
  module VirtualMachineImageManagement
20
20
  module Serialization
21
-
22
21
  def self.virtual_machine_images_from_xml(imageXML)
23
- os_images = Array.new
22
+ os_images = []
24
23
  virtual_machine_images = imageXML.css('Images OSImage')
25
24
  virtual_machine_images.each do |image_node|
26
25
  image = VirtualMachineImage.new
@@ -34,20 +33,19 @@ module Azure
34
33
  end
35
34
 
36
35
  def self.disks_from_xml(diskXML)
37
- os_disks = Array.new
36
+ os_disks = []
38
37
  disks = diskXML.css('Disks Disk')
39
38
  disks.each do |disk_node|
40
39
  disk = VirtualMachineDisk.new
41
40
  disk.name = xml_content(disk_node, 'Name')
42
41
  disk.os_type = xml_content(disk_node, 'OS')
43
- disk.attached = !xml_content(disk_node,'AttachedTo').empty?
42
+ disk.attached = !xml_content(disk_node, 'AttachedTo').empty?
44
43
  disk.image = xml_content(disk_node, 'SourceImageName')
45
44
  disk.size = xml_content(disk_node, 'LogicalDiskSizeInGB')
46
45
  os_disks << disk
47
46
  end
48
47
  os_disks
49
48
  end
50
-
51
49
  end
52
50
  end
53
- end
51
+ end
@@ -15,13 +15,11 @@
15
15
  module Azure
16
16
  module VirtualMachineImageManagement
17
17
  class VirtualMachineDisk
18
-
19
18
  def initialize
20
19
  yield self if block_given?
21
20
  end
22
21
 
23
22
  attr_accessor :name, :attached, :os_type, :image, :size
24
-
25
23
  end
26
24
  end
27
25
  end
@@ -15,13 +15,11 @@
15
15
  module Azure
16
16
  module VirtualMachineImageManagement
17
17
  class VirtualMachineImage
18
-
19
18
  def initialize
20
19
  yield self if block_given?
21
20
  end
22
21
 
23
22
  attr_accessor :os_type, :name, :category, :locations
24
-
25
23
  end
26
24
  end
27
25
  end