lib/azure/cloud_service_management/serialization.rb in azure-0.6.3 vs lib/azure/cloud_service_management/serialization.rb in azure-0.6.4

- old
+ new

@@ -64,12 +64,14 @@ props_xml = cloud_service_xml.css('HostedServiceProperties') cloud.label = Base64.decode64(xml_content(props_xml, 'Label')) cloud.description = xml_content(props_xml, 'Description') - cloud.location = xml_content(props_xml, 'Location') - cloud.affinity_group = xml_content(props_xml, 'AffinityGroup') + location = xml_content(props_xml, 'Location') + cloud.location = location unless location.empty? + affinity_group = xml_content(props_xml, 'AffinityGroup') + cloud.affinity_group = affinity_group unless affinity_group cloud.status = xml_content(props_xml, 'Status') cloud.date_created = xml_content(props_xml, 'DateCreated') cloud.date_modified = xml_content(props_xml, 'DateLastModified') cloud.extended_properties = {} @@ -80,37 +82,36 @@ end cloud.default_winrm_certificate_thumbprint = xml_content( cloud_service_xml, 'DefaultWinRMCertificateThumbprint' ) - + deployment_xml = cloud_services_xml.css('Deployments Deployment') + cloud.deployment_name = xml_content(deployment_xml, 'Name') vms_in_deployment = {} cloud_service_xml.css('Deployments').each do |deployxml| deployment_name = xml_content(deployxml, 'Deployment Name') vms = Azure::VirtualMachineManagement::Serialization.virtual_machines_from_xml( deployxml, cloud.name ) - - vms_in_deployment[deployment_name.to_sym] = vms + vms_in_deployment[deployment_name.to_sym] = vms if vms end cloud.virtual_machines = vms_in_deployment clouds << cloud end clouds.compact end def self.add_certificate_to_xml(data) builder = Nokogiri::XML::Builder.new do |xml| - xml.CertificateFile('xmlns'=>'http://schemas.microsoft.com/windowsazure') { + xml.CertificateFile('xmlns' => 'http://schemas.microsoft.com/windowsazure') do xml.Data data xml.CertificateFormat 'pfx' xml.Password nil - } + end end builder.doc.to_xml end - end end end