Removed publish settings file approach.
This commit is contained in:
Родитель
9c27402e93
Коммит
a4113e3d0d
|
@ -334,8 +334,9 @@ require 'azure'
|
|||
|
||||
Azure.configure do |config|
|
||||
# Configure these 2 properties to use Storage
|
||||
config.publish_settings_file = 'c:/my.publishsettings'
|
||||
config.subscription_id = "your subscription id" #optional
|
||||
config.management_certificate = "c:/my_cert.pem"
|
||||
config.subscription_id = "your subscription id"
|
||||
config.management_endpoint = "https://management.core.windows.net"
|
||||
end
|
||||
|
||||
#Create a virtual machine service object
|
||||
|
@ -367,8 +368,8 @@ options = {
|
|||
:cloud_service_name => 'cloud_service_name',
|
||||
:deployment_name =>'mydeployment',
|
||||
:tcp_endpoints => '80,3889:3889',
|
||||
:ssh_private_key_file => 'c:/private_key.key', #required for ssh or winrm(https) certificate.
|
||||
:ssh_certificate_file => 'c:/certificate.pem', #required for ssh or winrm(https) certificate.
|
||||
:private_key_file => 'c:/private_key.key', #required for ssh or winrm(https) certificate.
|
||||
:certificate_file => 'c:/certificate.pem', #required for ssh or winrm(https) certificate.
|
||||
:ssh_port => 2222,
|
||||
:vm_size => 'Large' #valid choices are (ExtraSmall, Small, Medium, Large, ExtraLarge, A6, A7)
|
||||
}
|
||||
|
|
7
Rakefile
7
Rakefile
|
@ -32,7 +32,9 @@ namespace :test do
|
|||
ENV.fetch("AZURE_SERVICEBUS_NAMESPACE", nil),
|
||||
ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY", nil),
|
||||
# ENV.fetch("AZURE_SERVICEBUS_ISSUER", nil)
|
||||
ENV.fetch('AZURE_PUBLISH_SETTINGS_FILE', nil)
|
||||
ENV.fetch('AZURE_MANAGEMENT_CERTIFICATE', nil),
|
||||
ENV.fetch('AZURE_SUBSCRIPTION_ID', nil),
|
||||
ENV.fetch('AZURE_MANAGEMENT_ENDPOINT', nil)
|
||||
].include?(nil)
|
||||
|
||||
abort "[ABORTING] Configure your environment to run the integration tests" if unset_environment
|
||||
|
@ -102,6 +104,9 @@ namespace :test do
|
|||
config.acs_namespace = ENV.fetch("AZURE_SERVICEBUS_NAMESPACE")
|
||||
config.sb_access_key = ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY")
|
||||
# config.sb_issuer = ENV.fetch("AZURE_SERVICEBUS_ISSUER")
|
||||
config.management_certificate = ENV.fetch('AZURE_MANAGEMENT_CERTIFICATE')
|
||||
config.management_endpoint = ENV.fetch("AZURE_MANAGEMENT_ENDPOINT")
|
||||
config.subscription_id = ENV.fetch("AZURE_SUBSCRIPTION_ID")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -27,15 +27,34 @@ module Azure
|
|||
module BaseManagement
|
||||
class BaseManagementService
|
||||
|
||||
def initialize(options={})
|
||||
publish_settings_file = options[:publish_settings_file] || Azure.config.publish_settings_file
|
||||
certificate = Certificate.new(:publish_settings_file=> publish_settings_file)
|
||||
Azure.configure do |config|
|
||||
config.http_certificate_key = certificate.cert
|
||||
config.http_private_key = certificate.key
|
||||
config.api_url ||= certificate.api_url
|
||||
config.subscription_id = certificate.subscription_id
|
||||
def initialize
|
||||
validate_configuration
|
||||
cert_file = File.read (Azure.config.management_certificate)
|
||||
begin
|
||||
if Azure.config.management_certificate =~ /(pem)$/
|
||||
certificate_key = OpenSSL::X509::Certificate.new(cert_file)
|
||||
private_key = OpenSSL::PKey::RSA.new(cert_file)
|
||||
else
|
||||
#Parse pfx content
|
||||
cert_content = OpenSSL::PKCS12.new(Base64.decode64(cert_file))
|
||||
certificate_key = OpenSSL::X509::Certificate.new(cert_content.certificate.to_pem)
|
||||
private_key = OpenSSL::PKey::RSA.new(cert_content.key.to_pem)
|
||||
end
|
||||
rescue Exception => e
|
||||
raise RuntimeError, "Management certificate not valid. Error: #{e.message}"
|
||||
end
|
||||
|
||||
Azure.configure do |config|
|
||||
config.http_certificate_key = certificate_key
|
||||
config.http_private_key = private_key
|
||||
end
|
||||
end
|
||||
|
||||
def validate_configuration
|
||||
raise RuntimeError, "Subscription ID not valid." if Azure.config.subscription_id.nil? or Azure.config.subscription_id.empty?
|
||||
raise RuntimeError, "Management endpoint not valid." if Azure.config.management_endpoint.nil? or Azure.config.management_endpoint.empty?
|
||||
raise RuntimeError, "Could not read from file '#{Azure.config.management_certificate}'." unless (test 'r', Azure.config.management_certificate)
|
||||
raise RuntimeError, "Management certificate expects a .pem or .pfx file." unless(Azure.config.management_certificate =~ /(pem|pfx)$/)
|
||||
end
|
||||
|
||||
# Public: Gets a list of regional data center locations from the server
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
#-------------------------------------------------------------------------
|
||||
# Copyright 2013 Microsoft Open Technologies, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#--------------------------------------------------------------------------
|
||||
require 'openssl'
|
||||
require 'fileutils'
|
||||
require 'uri'
|
||||
|
||||
module Azure
|
||||
module BaseManagement
|
||||
class Certificate
|
||||
attr_accessor :key, :cert, :api_url, :subscription_id
|
||||
|
||||
def initialize(options={})
|
||||
publish_settings_file = options[:publish_settings_file] || Azure.config.publish_settings_file
|
||||
begin
|
||||
doc = Nokogiri::XML(File.open(locate_file(publish_settings_file)))
|
||||
@subscription_id = Azure.config.subscription_id || doc.at_css("Subscription").attribute("Id").value
|
||||
profile = doc.css("PublishProfile Subscription")
|
||||
subscription_ids = profile.collect {|pf| pf.attribute("Id").value}
|
||||
if doc.at_css("PublishProfile").attribute("SchemaVersion").nil?
|
||||
if subscription_ids.include?(@subscription_id)
|
||||
cert_content = OpenSSL::PKCS12.new(Base64.decode64(doc.at_css("PublishProfile").attribute("ManagementCertificate").value))
|
||||
end
|
||||
@api_url = URI(doc.at_css("PublishProfile").attribute("Url").value).host
|
||||
elsif doc.at_css("PublishProfile").attribute("SchemaVersion").value == "2.0"
|
||||
profile.each do |pf|
|
||||
if pf.attribute("Id").value == @subscription_id
|
||||
cert_content = OpenSSL::PKCS12.new(Base64.decode64(pf.attribute("ManagementCertificate").value))
|
||||
@api_url = URI(pf.attribute("ServiceManagementUrl").value).host
|
||||
end
|
||||
end
|
||||
else
|
||||
Loggerx.error_with_exit "Publish Settings file schema not supported - #{publish_settings_file}"
|
||||
end
|
||||
if cert_content && @subscription_id
|
||||
@cert = OpenSSL::X509::Certificate.new(cert_content.certificate.to_pem)
|
||||
@key = OpenSSL::PKey::RSA.new(cert_content.key.to_pem)
|
||||
else
|
||||
raise RuntimeError, "Subscription ID not valid."
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,7 +14,6 @@
|
|||
#--------------------------------------------------------------------------
|
||||
require "azure/core/http/http_response"
|
||||
require "azure/core/http/http_request"
|
||||
require "azure/base_management/certificate"
|
||||
include Azure::Core::Http
|
||||
|
||||
# Represents an HTTP request that can perform synchronous queries to
|
||||
|
@ -36,7 +35,7 @@ module Azure
|
|||
super
|
||||
@warn = false
|
||||
@headers = {"x-ms-version" => "2013-06-01", "Content-Type"=> 'application/xml' }
|
||||
@uri = URI.parse(Azure.config.api_url + Azure.config.subscription_id + path)
|
||||
@uri = URI.parse(Azure.config.management_endpoint + Azure.config.subscription_id + path)
|
||||
@key = Azure.config.http_private_key
|
||||
@cert = Azure.config.http_certificate_key
|
||||
end
|
||||
|
|
|
@ -30,7 +30,7 @@ Azure.configure do |config|
|
|||
config.sb_access_key = ENV["AZURE_SERVICEBUS_ACCESS_KEY"]
|
||||
config.sb_issuer = ENV["AZURE_SERVICEBUS_ISSUER"]
|
||||
|
||||
config.publish_settings_file = ENV["AZURE_PUBLISH_SETTINGS_FILE"]
|
||||
config.subscription_id = ENV["AZURE_SUBSCRIPTION_ID"]
|
||||
config.api_url = ENV["AZURE_API_URL"]
|
||||
config.management_certificate = ENV["AZURE_MANAGEMENT_CERTIFICATE"]
|
||||
config.subscription_id = ENV["AZURE_SUBSCRIPTION_ID"]
|
||||
config.management_endpoint = ENV["AZURE_MANAGEMENT_ENDPOINT"]
|
||||
end
|
|
@ -153,13 +153,13 @@ module Azure
|
|||
#===================================================================
|
||||
|
||||
# Public: Get the Subscription Id and certificate key for the management API.
|
||||
attr_accessor :publish_settings_file
|
||||
attr_accessor :management_certificate
|
||||
|
||||
# Public: Get/Set the Subscription Id for the management API.
|
||||
attr_accessor :subscription_id
|
||||
|
||||
# Public: Set the host for the management API.
|
||||
attr_writer :api_url
|
||||
attr_writer :management_endpoint
|
||||
|
||||
#Public: Set the private key for SSL/HTTPS request with PEM certificate
|
||||
attr_accessor :http_private_key
|
||||
|
@ -167,8 +167,14 @@ module Azure
|
|||
#Public: Set the certificate key for SSL/HTTPS request with PEM certificate
|
||||
attr_accessor :http_certificate_key
|
||||
|
||||
def api_url
|
||||
"https://#{@api_url}/" if @api_url
|
||||
def management_endpoint
|
||||
if !@management_endpoint.end_with?('/')
|
||||
@management_endpoint += '/'
|
||||
elsif URI(@management_endpoint).scheme.nil?
|
||||
"https://#{@management_endpoint}"
|
||||
else
|
||||
@management_endpoint
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PublishData>
|
||||
<PublishProfile
|
||||
PublishMethod="AzureServiceManagementAPI"
|
||||
Url="https://management.core.windows.net/"
|
||||
ManagementCertificate="MIIKZAIBAzCCCiQGCSqGSIb3DQEHAaCCChUEggoRMIIKDTCCBe4GCSqGSIb3DQEHAaCCBd8EggXbMIIF1zCCBdMGCyqGSIb3DQEMCgECoIIE7jCCBOowHAYKKoZIhvcNAQwBAzAOBAisbmWQy24mMQICB9AEggTIRdb08OWoCxpCCf2XCCqU5Osuh9H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cHXY78rpycDUWKWZTHSXr40Mgtpa+WWar4E9hQ8+V3hVqvq8SHQjLSRaEZbGrLMDcwHzAHBgUrDgMCGgQU6M2Ox78Kllc3ueyiQO4FknVZJ1sEFInVnPg5otwboSdrPc7rBecgTDky">
|
||||
<Subscription
|
||||
Id="test-id-3"
|
||||
Name="Ruby Tests" />
|
||||
<Subscription
|
||||
Id="test-id-4"
|
||||
Name="Java Tests" />
|
||||
</PublishProfile>
|
||||
</PublishData>
|
|
@ -1,17 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PublishData>
|
||||
<PublishProfile
|
||||
SchemaVersion="2.0"
|
||||
PublishMethod="AzureServiceManagementAPI">
|
||||
<Subscription
|
||||
ServiceManagementUrl="https://test-id-1.core.windows.net"
|
||||
Id="test-id-1"
|
||||
Name="test-1"
|
||||
ManagementCertificate="MIIKZAIBAzCCCiQGCSqGSIb3DQEHAaCCChUEggoRMIIKDTCCBe4GCSqGSIb3DQEHAaCCBd8EggXbMIIF1zCCBdMGCyqGSIb3DQEMCgECoIIE7jCCBOowHAYKKoZIhvcNAQwBAzAOBAhq6inkycJkuQICB9AEggTIiFz4U8Euu08UyfFjDp6fHEFQWZcEP75iYzLxfYEayaxehiKDoXZUSIyBqKRDnVDN5cIpwDgTthTIU+P4fsL6wvoxeMbvxrHcIARd3W69gxEzpYstgHfwrbSf2NfB5qA2ITxw1whMjGeeyUDaDkt1S8XGQavPqQRHSQTkCediwURNy5Z5E+m0RfTDPvM3LX7dRCKVVZucvpw7TiqILwMujXe8ZFwshQD2HiNBHIXtzmoMDyXxhCCONe5HDB6qnKGFv0iORwWXpEhJq01DnP8HlDu38bmEBdPCWMgtOgBqNgmbZbK1Nqk/awe1RS1nvhBpcWj5TGVR8fqHZo/6rAx0je06qsZm+vfBOcve7P9oIaQmWSXb7rMTlx01hEEhdeFFaIaduGEiPfljawxRBOPPDq7eAGY345UmEosyZZezP2IJMdcHjywcOkU1BUghff5nloBRoz3gCQU79gC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YsOu00UNm1jw0vxiPisx+5hgEjuGAba4tACYIBBDacMFUsrQYYT8KBSu7hP1DVIfIInnnUi15FckFgjbaVepuFebEQ2bQacqumlfml/fZ7yixueW6FokhdesqBg+IG/GqoV+B+QUmxl+OhP6Z7cw1BsL6RcofuTTnC9VoFcpu4x1Q0SwOJhUrhJPLCCmNGfspyaS20/bGpOKW2dyzNurJPCf5KOntC86eLAOkXJthEQQ9i80BuM3OHE6ojwobrsB7hhrachYjO3o4ErviR/rhmCLuQ+tWdsY6bB68rdvBzSK6Bjm1XTogCqmYZGD9H1FeafjeNufEencvQxkP0ykTI1lJRmq0eESTC9j8tlqsk/78Djqxs5RFKyi0gHYxUG2pvweWvk/oZzG1eSNBoxxCPj4cPHko2ZzGVRXBzatRhDBXhaeljUsHXYnR/hAcpAfvAw1GaOR7CTnVOYAmkn9ytFWbKtQveXjHQoMspa9BK7VAnAI6TSh0qjlGcqgzdCKzW+RE2Qa4wbSmeVQ8L2L+8xphqGYv/3Xmm/ZHcCdJjWmsSR2CI47jywoxKd3j48DaBvdzp34rCthV4VtaY7og2iRyDhenZaDeD3gVTGxO2EeN/A5/4NBUqynuGFP/W9N6iGz5woMwXv/+6EmD1NdWrgMDcwHzAHBgUrDgMCGgQUb8PCc8n0EN9CF8RxBwigv3pSbesEFKOYJ2hj8Sd2OeJi5YvVPwdR4IZZ" />
|
||||
<Subscription
|
||||
ServiceManagementUrl="https://test-id-2.core.windows.net"
|
||||
Id="test-id-2"
|
||||
Name="test-2"
|
||||
ManagementCertificate="MIIKJAIBAzCCCeQGCSqGSIb3DQEHAaCCCdUEggnRMIIJzTCCBe4GCSqGSIb3DQEHAaCCBd8EggXbMIIF1zCCBdMGCyqGSIb3DQEMCgECoIIE7jCCBOowHAYKKoZIhvcNAQwBAzAOBAjFFqfov0NkqAICB9AEggTIAQxwrygDLcc1uuSTL8owojZ7QoElRy8qaKbn/MmFo3QUmGPNzhCcUXJKW5yNe5ffR1WinyH4jzeW1mY5Pol4hBRu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||
</PublishData>
|
|
@ -0,0 +1,55 @@
|
|||
Bag Attributes
|
||||
localKeyID: 01 00 00 00
|
||||
friendlyName: {D4417DE0-CB19-4947-B5B4-DE6D7F72171D}
|
||||
Microsoft CSP Name: Microsoft Software Key Storage Provider
|
||||
Key Attributes: <No Attributes>
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDlVqp43jiBkO2M
|
||||
YOpCqofHsFHaooZCmYSAxyZGyxQLPEc4Zvft0uzIdQy6QnzN+MQkQ8hWrL+BNp2S
|
||||
NYPFIXY9HYz5BZBMomM/lTsZltLgJSQENE6jTomznCgRy4GNg0hkaGkuhSSbWmBC
|
||||
jmlfJXkbZgfGuc5Lz8BZYPWO5hvP23XIRnVIW44oKcQfvkS80qyyzFNa0vdp3rov
|
||||
WdKV3QfScDIgTr0FQDANYTYWBV/r4xnXndjLOxgVwU3Kp0WPUkCz3uloMRGWs974
|
||||
bpWGwnOblJb4j0X7Q46rTZ4f4HGZlKbeRV/MtPcrZJ+V6ovQ9tz1sUbbCbn4ABag
|
||||
m+6NCcqRAgMBAAECggEAHHRMidsOeTrlUke7AQL9/j9o5H7KOCyqdTzgSaPMLJmx
|
||||
v3R9GeeT48osBlcV+4a8MMCtNF3SE+LWGYwkuXptnGcUdNglH3D9befi0Ym2R8Or
|
||||
7I6d3CK0MJH1IcIVZJyviG+w7ynrURAdRdy8A6dXV5go6lXm296co3ZFeVGhDUCR
|
||||
838zthk0Ltf347nLerhJUhJAIOX7Ct21xMOrbT5KfOVThgTxrZKmP29ORMoqnXN8
|
||||
8SdpHsdqdNro8uSEARyG80g4ZZVPVqZqRLr+cX080lJ4p8GPf/nPOWGGrtGCCEgI
|
||||
1FCX8aWH3PGOSLqo3boSiZfrLHT5BhJsXD/OXJZPzQKBgQD9vl+jiZSHPoo63/JO
|
||||
uKS0kGos6ZZc4WvjXx6JBrtnsOdw9YBAPKEY9VYyKi3fnv1v1gIB65e9rfeF+PmI
|
||||
KXKLwLcZWFRbaaB3xs3Bxo0Yn1tRRvANDAKR8Xfl77B06j2kKrPmfdEbmd3hHJqN
|
||||
ZYG4hj+PR1SQ+0jvwSg7cPtwrQKBgQDnYLxxoejm+JrEVGebvKv3AWDshBN+91dX
|
||||
iM4u5zke4qzocp0RYpjIjkUIb6Y/jwxscZmgetu9keDBAFCPU2ReTjFGmHZiip72
|
||||
xxQLF2dxlqgcSzURW9SjbstB0LUyxbTwIYTTOavHBrvnkw9S4rgLVHTVWzzInWag
|
||||
iw4lbfBp9QKBgC7KTS6F7zqlQK4sn6z+hXi6bKnNhSmpc9CguKvB7wrm5zbAPp8Z
|
||||
zwcgLn3fo0fqNIfL6eDaxcd3bf5pc/I02meE6P6meB/HMY0Fe72w1FHnCNrK/vcY
|
||||
8Nxir55Z/asBis5cBYKKTuYNEIozURij0DDrqIrON3zoqYF0l+umIOedAoGAYiTn
|
||||
ai/qkeaMB5Fh7W6HZxvfmBOiDW4vT0MJal3MHey6uVK8iz5OXmvynlR1qWotM+av
|
||||
6qGSigPR2Swf/9u4rEPwpOhQ9xWjvjvNpbLEvyrPnkjMdtOEC9sYPo+f/KxeRqmB
|
||||
JPPGiIKzu9PmYRsoRC4L7OBplRMnEBxL4NaUbu0CgYEA2z7BuOzuE3QmxaNzbP7+
|
||||
PWkRg0JEFksN/8bRo6fuVMaosEs4jZunCyPk0ne//p+dcKE8cInC9/jGJs5XutUi
|
||||
L8KuTu3ljFOLE/y+8FHR/Hxpvzp8k6iDPl7mvvZJ7gt2aO9IZq3XHoRLbgSUPo2X
|
||||
YlXoh+vo+SQVRQtbxpuk1gM=
|
||||
-----END PRIVATE KEY-----
|
||||
Bag Attributes
|
||||
localKeyID: 01 00 00 00
|
||||
friendlyName: Ruby SDK
|
||||
subject=/CN=Windows Azure Tools
|
||||
issuer=/CN=Windows Azure Tools
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIICxDCCAaygAwIBAgIQQ86pQDjNkolP6pILfxFhITANBgkqhkiG9w0BAQUFADAe
|
||||
MRwwGgYDVQQDExNXaW5kb3dzIEF6dXJlIFRvb2xzMB4XDTEzMDUxNjA0NDgzNloX
|
||||
DTE0MDUxNjA0NDgzNlowHjEcMBoGA1UEAxMTV2luZG93cyBBenVyZSBUb29sczCC
|
||||
ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOVWqnjeOIGQ7Yxg6kKqh8ew
|
||||
UdqihkKZhIDHJkbLFAs8Rzhm9+3S7Mh1DLpCfM34xCRDyFasv4E2nZJ1g8Uhdj0d
|
||||
jPkFkEyiYz+VOxmW0uAlJCQ0TqNOibOcKBHLgY2DSGRoaS6FJJtaYEKOaV8leRtm
|
||||
B8a5zkvPsFlg9Y7mG8/bdchGdUhbjigpxB++RLzSrLLMU1rS92neui9Z0pXdB9Jw
|
||||
MiBOvQVAMA1hNhYFX+vjGded2Ms7GBXBTcqnRY9SQLPe6WgxEZaz3vaulYbCc5uU
|
||||
lviPRftDjqtNnh/gcZmUpt5FX8y09ytkn5Xqi9D23PWxRtsJufgAFqCb7o0JypEC
|
||||
AwEAATANBgkqhkiG9w0BAQUFAAOCAQEAFkhTUWZN3xvh50zvDBRJgvc83kx61Npl
|
||||
J1G6F98aa+mdZmkbXLdNt+dHR+aGg/0RAs97yPoSc9km5uedEpQQD0xDh9X84jSv
|
||||
GnrGTsmjBMJvE8jhT0P/zGfTKfncQOx00cVcNm5F1GdWsni7OcVuOLQ+0se8VHsR
|
||||
JSQBBWQVZOXJp2zYs935jrI47bCCNSNFQ1sAvxFdMeBZKwtmvhp1c6Zl3j/KVbvL
|
||||
S0Izpu1vXvozNDo6HmJPhpONU6qlMfU2iSzUQN21PRt82vMOVx4xyBzbm6vPc50g
|
||||
PR10SWXaXL/UmBlxfJ3nhD1YgqIQtWMdbSQ81j3MzrGrrlIdjPUFOw==
|
||||
-----END CERTIFICATE-----
|
|
@ -25,7 +25,9 @@ Azure::Core.configure do |config|
|
|||
config.sb_namespace = ENV.fetch("AZURE_SERVICEBUS_NAMESPACE")
|
||||
config.sb_access_key = ENV.fetch("AZURE_SERVICEBUS_ACCESS_KEY")
|
||||
# config.sb_issuer = ENV.fetch("AZURE_SERVICEBUS_ISSUER")
|
||||
config.publish_settings_file = ENV.fetch('AZURE_PUBLISH_SETTINGS_FILE')
|
||||
config.management_certificate = ENV.fetch('AZURE_MANAGEMENT_CERTIFICATE')
|
||||
config.management_endpoint = ENV.fetch("AZURE_MANAGEMENT_ENDPOINT")
|
||||
config.subscription_id = ENV.fetch("AZURE_SUBSCRIPTION_ID")
|
||||
end
|
||||
|
||||
StorageAccountName = random_string('storagetest',10)
|
||||
|
|
|
@ -42,7 +42,9 @@ require 'azure'
|
|||
|
||||
Azure.config.storage_account_name = "accountname"
|
||||
Azure.config.storage_access_key = "YWNjZXNzLWtleQ=="
|
||||
Azure.config.publish_settings_file = File.expand_path("test/fixtures/azure.publishsettings")
|
||||
Azure.config.management_certificate = File.expand_path("test/fixtures/management_certificate.pem")
|
||||
Azure.config.management_endpoint = "https://management.core.windows.net"
|
||||
Azure.config.subscription_id = "subscription-id"
|
||||
# Azure.config.storage_table_host =
|
||||
# Azure.config.storage_blob_host =
|
||||
# Azure.config.storage_queue_host =
|
||||
|
|
|
@ -1,116 +0,0 @@
|
|||
#-------------------------------------------------------------------------
|
||||
# Copyright 2013 Microsoft Open Technologies, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#--------------------------------------------------------------------------
|
||||
require "test_helper"
|
||||
|
||||
describe Azure::BaseManagement::Certificate do
|
||||
|
||||
subject do
|
||||
Azure::BaseManagement::Certificate
|
||||
end
|
||||
after do
|
||||
Azure.config.subscription_id = nil
|
||||
end
|
||||
|
||||
describe "#new" do
|
||||
|
||||
let(:old_format_publicsettings_file) { Fixtures['azure.publishsettings'] }
|
||||
let(:new_format_publicsettings_file) { Fixtures['azure_new_format.publishsettings'] }
|
||||
let(:invalid_publishsettings_file) { Fixtures['invalid.publishsettings'] }
|
||||
|
||||
it "should set properties of old publishsettings file" do
|
||||
Azure.config.subscription_id = nil
|
||||
certificate = subject.new(:publish_settings_file => old_format_publicsettings_file)
|
||||
certificate.subscription_id.must_equal "test-id-3"
|
||||
certificate.api_url.must_equal "management.core.windows.net"
|
||||
certificate.key.wont_be_nil
|
||||
certificate.cert.wont_be_nil
|
||||
end
|
||||
|
||||
it "should set properties of given subscription id for old publishsettings file" do
|
||||
Azure.config.subscription_id = 'test-id-4'
|
||||
certificate = subject.new(:publish_settings_file => old_format_publicsettings_file)
|
||||
certificate.subscription_id.must_equal "test-id-4"
|
||||
certificate.api_url.must_equal "management.core.windows.net"
|
||||
certificate.key.wont_be_nil
|
||||
certificate.cert.wont_be_nil
|
||||
end
|
||||
|
||||
it "should raise error when invalid subscription is given for old publishsettings file." do
|
||||
Azure.configure do |config|
|
||||
config.subscription_id = 'wrong_id'
|
||||
end
|
||||
|
||||
exception = assert_raises(RuntimeError) do
|
||||
subject.new(:publish_settings_file => old_format_publicsettings_file)
|
||||
end
|
||||
assert_match(/Subscription ID not valid./i, exception.message)
|
||||
end
|
||||
|
||||
it "should set properties of given subscription id for new publishsettings file" do
|
||||
Azure.configure do |config|
|
||||
config.subscription_id = "test-id-1"
|
||||
config.publish_settings_file = new_format_publicsettings_file
|
||||
end
|
||||
certificate1 = subject.new
|
||||
certificate1.subscription_id.must_equal "test-id-1"
|
||||
certificate1.api_url.must_equal "test-id-1.core.windows.net"
|
||||
certificate1.key.wont_be_nil
|
||||
certificate1.cert.wont_be_nil
|
||||
|
||||
Azure.configure do |config|
|
||||
config.subscription_id = "test-id-2"
|
||||
config.publish_settings_file = new_format_publicsettings_file
|
||||
end
|
||||
certificate2 = subject.new
|
||||
certificate2.subscription_id.must_equal "test-id-2"
|
||||
certificate2.api_url.must_equal "test-id-2.core.windows.net"
|
||||
certificate2.key.wont_be_nil
|
||||
certificate2.cert.wont_be_nil
|
||||
refute_equal(certificate2.cert, certificate1.cert)
|
||||
refute_equal(certificate2.key, certificate1.key)
|
||||
end
|
||||
|
||||
it "should set use first subscription when no subscription is given for new publishsettings file." do
|
||||
Azure.configure do |config|
|
||||
config.subscription_id = nil
|
||||
end
|
||||
certificate = subject.new(:publish_settings_file => new_format_publicsettings_file)
|
||||
certificate.subscription_id.must_equal "test-id-1"
|
||||
certificate.api_url.must_equal "test-id-1.core.windows.net"
|
||||
certificate.key.wont_be_nil
|
||||
certificate.cert.wont_be_nil
|
||||
end
|
||||
|
||||
it "should raise error when invalid subscription is given for new publishsettings file." do
|
||||
Azure.configure do |config|
|
||||
config.subscription_id = 'wrong_id'
|
||||
end
|
||||
|
||||
exception = assert_raises(RuntimeError) do
|
||||
subject.new(:publish_settings_file => new_format_publicsettings_file)
|
||||
end
|
||||
assert_match(/Subscription ID not valid./i, exception.message)
|
||||
end
|
||||
|
||||
it "should raise error when invalid publishsettings file is given." do
|
||||
Azure.config.subscription_id = nil
|
||||
exception = assert_raises(OpenSSL::PKCS12::PKCS12Error) do
|
||||
subject.new(:publish_settings_file => invalid_publishsettings_file)
|
||||
end
|
||||
assert_match(/PKCS12_parse: mac verify failure/i, exception.message)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Загрузка…
Ссылка в новой задаче