fog-azure-rm 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/fog/azurerm/custom_fog_errors.rb +18 -0
- data/lib/fog/azurerm/utilities/general.rb +5 -5
- data/lib/fog/azurerm/version.rb +1 -1
- data/test/requests/application_gateway/test_check_ag_exists.rb +1 -1
- data/test/requests/application_gateway/test_create_or_update_application_gateway.rb +1 -1
- data/test/requests/application_gateway/test_delete_application_gateway.rb +1 -1
- data/test/requests/application_gateway/test_get_application_gateway.rb +1 -1
- data/test/requests/application_gateway/test_list_application_gateways.rb +1 -1
- data/test/requests/application_gateway/test_start_application_gateway.rb +1 -1
- data/test/requests/application_gateway/test_stop_application_gateway.rb +1 -1
- data/test/requests/compute/test_attach_data_disk_to_vm.rb +4 -4
- data/test/requests/compute/test_check_availability_set_exists.rb +1 -1
- data/test/requests/compute/test_check_managed_disk_exists.rb +1 -1
- data/test/requests/compute/test_check_vm_exists.rb +1 -1
- data/test/requests/compute/test_check_vm_extension_exists.rb +1 -1
- data/test/requests/compute/test_create_availability_set.rb +2 -2
- data/test/requests/compute/test_create_image.rb +1 -1
- data/test/requests/compute/test_create_or_update_managed_disk.rb +1 -1
- data/test/requests/compute/test_create_virtual_machine.rb +2 -2
- data/test/requests/compute/test_create_vm_extension.rb +1 -1
- data/test/requests/compute/test_deallocate_virtual_machine.rb +2 -2
- data/test/requests/compute/test_delete_availability_set.rb +1 -1
- data/test/requests/compute/test_delete_image.rb +1 -1
- data/test/requests/compute/test_delete_managed_disk.rb +1 -1
- data/test/requests/compute/test_delete_virtual_machine.rb +2 -2
- data/test/requests/compute/test_detach_data_disk_from_vm.rb +1 -1
- data/test/requests/compute/test_generalize_virtual_machine.rb +2 -2
- data/test/requests/compute/test_get_availability_set.rb +1 -1
- data/test/requests/compute/test_get_image.rb +1 -1
- data/test/requests/compute/test_get_managed_disk.rb +1 -1
- data/test/requests/compute/test_get_virtual_machine.rb +1 -1
- data/test/requests/compute/test_get_vm_extension.rb +1 -1
- data/test/requests/compute/test_get_vm_status.rb +1 -1
- data/test/requests/compute/test_grant_access_to_managed_disk.rb +1 -1
- data/test/requests/compute/test_list_availability_sets.rb +1 -1
- data/test/requests/compute/test_list_available_sizes_for_virtual_machine.rb +2 -2
- data/test/requests/compute/test_list_managed_disks_by_rg.rb +1 -1
- data/test/requests/compute/test_list_managed_disks_in_subscription.rb +1 -1
- data/test/requests/compute/test_list_virtual_machines.rb +1 -1
- data/test/requests/compute/test_power_off_virtual_machine.rb +2 -2
- data/test/requests/compute/test_redeploy_virtual_machine.rb +2 -2
- data/test/requests/compute/test_restart_virtual_machine.rb +2 -2
- data/test/requests/compute/test_revoke_access_to_managed_disk.rb +1 -1
- data/test/requests/compute/test_start_virtual_machine.rb +2 -2
- data/test/requests/compute/test_update_vm_extension.rb +1 -1
- data/test/requests/dns/test_check_record_set_exists.rb +1 -1
- data/test/requests/dns/test_check_zone_exists.rb +1 -1
- data/test/requests/dns/test_create_record_set.rb +1 -1
- data/test/requests/dns/test_create_zone.rb +1 -1
- data/test/requests/dns/test_delete_record_set.rb +1 -1
- data/test/requests/dns/test_delete_zone.rb +1 -1
- data/test/requests/dns/test_get_record_set.rb +1 -1
- data/test/requests/dns/test_get_records_from_record_set.rb +1 -1
- data/test/requests/dns/test_get_zone.rb +1 -1
- data/test/requests/dns/test_list_record_sets.rb +1 -1
- data/test/requests/dns/test_list_zones.rb +1 -1
- data/test/requests/key_vault/test_check_vault_exists.rb +1 -1
- data/test/requests/key_vault/test_create_or_update_vault.rb +1 -1
- data/test/requests/key_vault/test_delete_vault.rb +1 -1
- data/test/requests/key_vault/test_get_vault.rb +1 -1
- data/test/requests/key_vault/test_list_vaults.rb +1 -1
- data/test/requests/network/test_add_address_prefixes_in_virtual_network.rb +1 -1
- data/test/requests/network/test_add_dns_servers_in_virtual_network.rb +1 -1
- data/test/requests/network/test_add_subnets_in_virtual_network.rb +1 -1
- data/test/requests/network/test_attach_network_security_group_to_subnet.rb +1 -1
- data/test/requests/network/test_attach_resource_to_nic.rb +1 -1
- data/test/requests/network/test_attach_route_table_to_subnet.rb +1 -1
- data/test/requests/network/test_check_express_route_cir_auth_exists.rb +1 -1
- data/test/requests/network/test_check_express_route_circuit_exists.rb +1 -1
- data/test/requests/network/test_check_load_balancer_exists.rb +1 -1
- data/test/requests/network/test_check_local_net_gateway_exists.rb +1 -1
- data/test/requests/network/test_check_net_sec_group_exists.rb +1 -1
- data/test/requests/network/test_check_net_sec_rule_exists.rb +1 -1
- data/test/requests/network/test_check_network_interface_exists.rb +1 -1
- data/test/requests/network/test_check_public_ip_exists.rb +1 -1
- data/test/requests/network/test_check_subnet_exists.rb +1 -1
- data/test/requests/network/test_check_virtual_network_exists.rb +1 -1
- data/test/requests/network/test_check_vnet_gateway_connection_exists.rb +1 -1
- data/test/requests/network/test_check_vnet_gateway_exists.rb +1 -1
- data/test/requests/network/test_create_express_route_circuit.rb +1 -1
- data/test/requests/network/test_create_express_route_circuit_authorization.rb +1 -1
- data/test/requests/network/test_create_express_route_circuit_peering.rb +1 -1
- data/test/requests/network/test_create_load_balancer.rb +1 -1
- data/test/requests/network/test_create_local_network_gateway.rb +1 -1
- data/test/requests/network/test_create_network_interface.rb +1 -1
- data/test/requests/network/test_create_or_update_network_security_group.rb +1 -1
- data/test/requests/network/test_create_or_update_network_security_rule.rb +1 -1
- data/test/requests/network/test_create_or_update_virtual_network.rb +1 -1
- data/test/requests/network/test_create_public_ip.rb +1 -1
- data/test/requests/network/test_create_subnet.rb +1 -1
- data/test/requests/network/test_create_virtual_network_gateway.rb +1 -1
- data/test/requests/network/test_create_virtual_network_gateway_connection.rb +1 -1
- data/test/requests/network/test_delete_express_route_circuit.rb +1 -1
- data/test/requests/network/test_delete_express_route_circuit_authorization.rb +1 -1
- data/test/requests/network/test_delete_express_route_circuit_peering.rb +1 -1
- data/test/requests/network/test_delete_load_balancer.rb +1 -1
- data/test/requests/network/test_delete_local_network_gateway.rb +1 -1
- data/test/requests/network/test_delete_network_interface.rb +1 -1
- data/test/requests/network/test_delete_network_security_group.rb +1 -1
- data/test/requests/network/test_delete_network_security_rule.rb +1 -1
- data/test/requests/network/test_delete_public_ip.rb +1 -1
- data/test/requests/network/test_delete_subnet.rb +1 -1
- data/test/requests/network/test_delete_virtual_network.rb +1 -1
- data/test/requests/network/test_delete_virtual_network_gateway.rb +1 -1
- data/test/requests/network/test_delete_virtual_network_gateway_connection.rb +1 -1
- data/test/requests/network/test_detach_network_security_group_from_subnet.rb +1 -1
- data/test/requests/network/test_detach_resource_from_nic.rb +1 -1
- data/test/requests/network/test_detach_route_table_from_subnet.rb +1 -1
- data/test/requests/network/test_get_connection_shared_key.rb +1 -1
- data/test/requests/network/test_get_express_route_circuit.rb +1 -1
- data/test/requests/network/test_get_express_route_circuit_authorization.rb +1 -1
- data/test/requests/network/test_get_express_route_circuit_peering.rb +1 -1
- data/test/requests/network/test_get_load_balancer.rb +1 -1
- data/test/requests/network/test_get_local_network_gateway.rb +1 -1
- data/test/requests/network/test_get_network_interface.rb +1 -1
- data/test/requests/network/test_get_network_security_group.rb +1 -1
- data/test/requests/network/test_get_network_security_rule.rb +1 -1
- data/test/requests/network/test_get_public_ip.rb +1 -1
- data/test/requests/network/test_get_subnet.rb +1 -1
- data/test/requests/network/test_get_virtual_network.rb +1 -1
- data/test/requests/network/test_get_virtual_network_gateway.rb +1 -1
- data/test/requests/network/test_get_virtual_network_gateway_connection.rb +1 -1
- data/test/requests/network/test_list_express_route_circuit_authorizations.rb +1 -1
- data/test/requests/network/test_list_express_route_circuit_peerings.rb +1 -1
- data/test/requests/network/test_list_express_route_circuits.rb +1 -1
- data/test/requests/network/test_list_express_route_service_providers.rb +1 -1
- data/test/requests/network/test_list_load_balancers.rb +1 -1
- data/test/requests/network/test_list_local_network_gateways.rb +1 -1
- data/test/requests/network/test_list_network_interfaces.rb +1 -1
- data/test/requests/network/test_list_network_security_groups.rb +1 -1
- data/test/requests/network/test_list_network_security_rules.rb +1 -1
- data/test/requests/network/test_list_public_ips.rb +1 -1
- data/test/requests/network/test_list_subnets.rb +1 -1
- data/test/requests/network/test_list_virtual_network_gateway_connections.rb +1 -1
- data/test/requests/network/test_list_virtual_network_gateways.rb +1 -1
- data/test/requests/network/test_list_virtual_networks.rb +1 -1
- data/test/requests/network/test_list_virtual_networks_in_subscription.rb +1 -1
- data/test/requests/network/test_remove_address_prefixes_from_virtual_network.rb +1 -1
- data/test/requests/network/test_remove_dns_servers_from_virtual_network.rb +1 -1
- data/test/requests/network/test_remove_subnets_from_virtual_network.rb +1 -1
- data/test/requests/network/test_reset_connection_shared_key.rb +1 -1
- data/test/requests/network/test_set_connection_shared_key.rb +1 -1
- data/test/requests/network/test_update_public_ip.rb +1 -1
- data/test/requests/resources/test_check_deployment_exists.rb +1 -1
- data/test/requests/resources/test_check_resource_group_exists.rb +1 -1
- data/test/requests/resources/test_create_deployment.rb +1 -1
- data/test/requests/resources/test_create_resource_group.rb +1 -1
- data/test/requests/resources/test_delete_deployment.rb +1 -1
- data/test/requests/resources/test_delete_resource_group.rb +1 -1
- data/test/requests/resources/test_delete_resource_tag.rb +1 -1
- data/test/requests/resources/test_get_deployment.rb +1 -1
- data/test/requests/resources/test_get_resource_group.rb +1 -1
- data/test/requests/resources/test_list_deployments.rb +1 -1
- data/test/requests/resources/test_list_resource_groups.rb +1 -1
- data/test/requests/resources/test_list_tagged_resources.rb +1 -1
- data/test/requests/resources/test_tag_resource.rb +1 -1
- data/test/requests/sql/test_create_or_update_database.rb +1 -1
- data/test/requests/sql/test_create_or_update_firewall_rule.rb +1 -1
- data/test/requests/sql/test_create_or_update_sql_server.rb +1 -1
- data/test/requests/sql/test_delete_database.rb +1 -1
- data/test/requests/sql/test_delete_firewall_rule.rb +1 -1
- data/test/requests/sql/test_delete_sql_server.rb +1 -1
- data/test/requests/sql/test_get_database.rb +1 -1
- data/test/requests/sql/test_get_firewall_rule.rb +1 -1
- data/test/requests/sql/test_get_sql_server.rb +1 -1
- data/test/requests/sql/test_list_databases.rb +1 -1
- data/test/requests/sql/test_list_firewall_rules.rb +1 -1
- data/test/requests/sql/test_list_sql_servers.rb +1 -1
- data/test/requests/storage/test_acquire_blob_lease.rb +1 -1
- data/test/requests/storage/test_acquire_container_lease.rb +1 -1
- data/test/requests/storage/test_check_storage_account_exists.rb +1 -1
- data/test/requests/storage/test_check_storage_account_name_availability.rb +1 -1
- data/test/requests/storage/test_commit_blob_blocks.rb +1 -1
- data/test/requests/storage/test_compare_container_blobs.rb +1 -1
- data/test/requests/storage/test_copy_blob.rb +1 -1
- data/test/requests/storage/test_copy_blob_from_uri.rb +1 -1
- data/test/requests/storage/test_create_block_blob.rb +1 -1
- data/test/requests/storage/test_create_container.rb +1 -1
- data/test/requests/storage/test_create_page_blob.rb +1 -1
- data/test/requests/storage/test_create_storage_account.rb +1 -1
- data/test/requests/storage/test_delete_blob.rb +1 -1
- data/test/requests/storage/test_delete_container.rb +1 -1
- data/test/requests/storage/test_delete_storage_account.rb +1 -1
- data/test/requests/storage/test_get_blob.rb +3 -3
- data/test/requests/storage/test_get_blob_properties.rb +1 -1
- data/test/requests/storage/test_get_container_acl.rb +1 -1
- data/test/requests/storage/test_get_container_properties.rb +1 -1
- data/test/requests/storage/test_get_storage_access_keys.rb +1 -1
- data/test/requests/storage/test_get_storage_account.rb +1 -1
- data/test/requests/storage/test_list_blobs.rb +1 -1
- data/test/requests/storage/test_list_containers.rb +1 -1
- data/test/requests/storage/test_list_storage_accounts.rb +1 -1
- data/test/requests/storage/test_list_storage_accounts_for_rg.rb +1 -1
- data/test/requests/storage/test_put_blob_block.rb +1 -1
- data/test/requests/storage/test_put_blob_metadata.rb +1 -1
- data/test/requests/storage/test_put_blob_pages.rb +1 -1
- data/test/requests/storage/test_put_blob_properties.rb +1 -1
- data/test/requests/storage/test_put_container_acl.rb +1 -1
- data/test/requests/storage/test_put_container_metadata.rb +1 -1
- data/test/requests/storage/test_release_blob_lease.rb +1 -1
- data/test/requests/storage/test_release_container_lease.rb +1 -1
- data/test/requests/storage/test_update_storage_account.rb +1 -1
- data/test/requests/traffic_manager/test_check_traffic_manager_endpoint_exists.rb +1 -1
- data/test/requests/traffic_manager/test_check_traffic_manager_profile_exists.rb +1 -1
- data/test/requests/traffic_manager/test_create_traffic_manager_endpoint.rb +1 -1
- data/test/requests/traffic_manager/test_create_traffic_manager_profile.rb +1 -1
- data/test/requests/traffic_manager/test_delete_traffic_manager_endpoint.rb +1 -1
- data/test/requests/traffic_manager/test_delete_traffic_manager_profile.rb +1 -1
- data/test/requests/traffic_manager/test_get_traffic_manager_endpoint.rb +1 -1
- data/test/requests/traffic_manager/test_get_traffic_manager_profile.rb +1 -1
- data/test/requests/traffic_manager/test_list_traffic_manager_profiles.rb +1 -1
- data/test/requests/traffic_manager/test_update_traffic_manager_endpoint.rb +1 -1
- data/test/requests/traffic_manager/test_update_traffic_manager_profile.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4b9efeefac7a938ff930c43843ac651fb93a38af3555b3241ec970f8aca0e412
|
4
|
+
data.tar.gz: 3dcbbb882dd381a9b52f174f2c62d48ea6247888033820a7b4084eeb05758cb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba09be6a12ab9eb51298ed1ca9ac9a136004c0d1dec6606b4db9ca6125d1eb659c2471f7dc714178f5931f5ca70432d7dfdf2a1f17317ea877296d6f4fcb2f6
|
7
|
+
data.tar.gz: 1f6acc0b6182e755ad8d823bd7a9ff9ea91cc9cf92ad595d91df4258df6feb95518e83982cd5d7034547bab2dc81079b4539829d604e40a259ae5f74513d6b9a
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file contains any or all custom Fog errors that we create
|
2
|
+
module Fog
|
3
|
+
module AzureRM
|
4
|
+
# This is a custom Fog exception inherited from MsRestAzure::AzureOperationError
|
5
|
+
class CustomAzureOperationError < MsRestAzure::AzureOperationError
|
6
|
+
def initialize(message, azure_exception)
|
7
|
+
super(azure_exception.request, azure_exception.response, azure_exception.body, "Exception in #{message}")
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
# This is a custom Fog exception inherited from Azure::Core::Http::HTTPError
|
12
|
+
class CustomAzureCoreHttpError < Azure::Core::Http::HTTPError
|
13
|
+
def initialize(azure_exception)
|
14
|
+
super(azure_exception.http_response)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require File.expand_path('../../custom_fog_errors.rb', __FILE__)
|
2
|
+
|
1
3
|
# Pick Resource Group name from Azure Resource Id(String)
|
2
4
|
def get_resource_group_from_id(id)
|
3
5
|
id.split('/')[4]
|
@@ -47,11 +49,9 @@ def get_record_type(type)
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def raise_azure_exception(exception, msg)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
Fog::Logger.debug exception.backtrace
|
54
|
-
raise exception_message
|
52
|
+
raise Fog::AzureRM::CustomAzureCoreHttpError.new(exception) if exception.is_a?(Azure::Core::Http::HTTPError)
|
53
|
+
raise Fog::AzureRM::CustomAzureOperationError.new(msg, exception) if exception.is_a?(MsRestAzure::AzureOperationError)
|
54
|
+
raise exception
|
55
55
|
end
|
56
56
|
|
57
57
|
# Make sure if input_params(Hash) contains all keys present in required_params(Array)
|
data/lib/fog/azurerm/version.rb
CHANGED
@@ -32,7 +32,7 @@ class TestCheckAGExists < Minitest::Test
|
|
32
32
|
def test_check_app_gateway_exists_exception
|
33
33
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
34
34
|
@gateways.stub :get, response do
|
35
|
-
assert_raises(
|
35
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.check_ag_exists('fog-test-rg', 'fogRM-rg') }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -27,7 +27,7 @@ class TestCreateOrUpdateApplicationGateway < Minitest::Test
|
|
27
27
|
def test_create_or_update_application_gateway_exception_failure
|
28
28
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
29
29
|
@gateways.stub :create_or_update, response do
|
30
|
-
assert_raises
|
30
|
+
assert_raises MsRestAzure::AzureOperationError do
|
31
31
|
@service.create_or_update_application_gateway(@gateway_params)
|
32
32
|
end
|
33
33
|
end
|
@@ -17,7 +17,7 @@ class TestDeleteApplicationGateway < Minitest::Test
|
|
17
17
|
def test_delete_application_gateway_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@gateways.stub :delete, response do
|
20
|
-
assert_raises(
|
20
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.delete_application_gateway('fogRM-rg', 'gateway') }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -18,7 +18,7 @@ class TestGetApplicationGateway < Minitest::Test
|
|
18
18
|
def test_get_application_gateway_failure
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@gateways.stub :get, response do
|
21
|
-
assert_raises(
|
21
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.get_application_gateway('fog-test-rg', 'fogRM-rg') }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -18,7 +18,7 @@ class TestListApplicationGateways < Minitest::Test
|
|
18
18
|
def test_list_application_gateways_failure
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@gateways.stub :list_as_lazy, response do
|
21
|
-
assert_raises(
|
21
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.list_application_gateways('fogRM-rg') }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -17,7 +17,7 @@ class TestStartApplicationGateway < Minitest::Test
|
|
17
17
|
def test_start_application_gateway_exception_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@gateways.stub :start, response do
|
20
|
-
assert_raises
|
20
|
+
assert_raises MsRestAzure::AzureOperationError do
|
21
21
|
@service.start_application_gateway('test-rg', 'test-ag')
|
22
22
|
end
|
23
23
|
end
|
@@ -17,7 +17,7 @@ class TestStopApplicationGateway < Minitest::Test
|
|
17
17
|
def test_stop_application_gateway_exception_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@gateways.stub :stop, response do
|
20
|
-
assert_raises
|
20
|
+
assert_raises MsRestAzure::AzureOperationError do
|
21
21
|
@service.stop_application_gateway('test-rg', 'test-ag')
|
22
22
|
end
|
23
23
|
end
|
@@ -62,7 +62,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
62
62
|
@virtual_machines.stub :get, @get_vm_response do
|
63
63
|
@storage_accounts.stub :list_keys, @storage_access_keys_response do
|
64
64
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
65
|
-
assert_raises
|
65
|
+
assert_raises Azure::Core::Http::HTTPError do
|
66
66
|
@service.attach_data_disk_to_vm(@input_params, false)
|
67
67
|
end
|
68
68
|
end
|
@@ -75,7 +75,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
75
75
|
@virtual_machines.stub :get, @get_vm_response do
|
76
76
|
@storage_accounts.stub :list_keys, @storage_access_keys_response do
|
77
77
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
78
|
-
assert_raises
|
78
|
+
assert_raises Azure::Core::Http::HTTPError do
|
79
79
|
@service.attach_data_disk_to_vm(@input_params, false)
|
80
80
|
end
|
81
81
|
end
|
@@ -86,7 +86,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
86
86
|
def test_get_vm_failure
|
87
87
|
get_vm_response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
88
88
|
@virtual_machines.stub :get, get_vm_response do
|
89
|
-
assert_raises
|
89
|
+
assert_raises MsRestAzure::AzureOperationError do
|
90
90
|
@service.attach_data_disk_to_vm(@input_params, false)
|
91
91
|
end
|
92
92
|
end
|
@@ -96,7 +96,7 @@ class TestAttachDataDiskToVM < Minitest::Test
|
|
96
96
|
storage_access_keys_response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
97
97
|
@virtual_machines.stub :get, @get_vm_response do
|
98
98
|
@storage_accounts.stub :list_keys, storage_access_keys_response do
|
99
|
-
assert_raises
|
99
|
+
assert_raises MsRestAzure::AzureOperationError do
|
100
100
|
@service.attach_data_disk_to_vm(@input_params, false)
|
101
101
|
end
|
102
102
|
end
|
@@ -32,7 +32,7 @@ class TestCheckAvailabilitySetExists < Minitest::Test
|
|
32
32
|
def test_check_availability_set_exists_exception
|
33
33
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
34
34
|
@availability_sets.stub :get, response do
|
35
|
-
assert_raises(
|
35
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.check_availability_set_exists('myrg1', 'myavset1') }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -32,7 +32,7 @@ class TestCheckManagedDiskExists < Minitest::Test
|
|
32
32
|
def test_check_managed_disk_exists_exception
|
33
33
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
34
34
|
@managed_disks.stub :get, response do
|
35
|
-
assert_raises(
|
35
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.check_managed_disk_exists('myrg1', 'mydisk1') }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -32,7 +32,7 @@ class TestCheckVirtualMachineExists < Minitest::Test
|
|
32
32
|
def test_check_vm_exists_exception
|
33
33
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
34
34
|
@virtual_machines.stub :get, response do
|
35
|
-
assert_raises(
|
35
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.check_vm_exists('fog-test-rg', 'fog-test-server', false) }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -32,7 +32,7 @@ class TestCheckVMExtensionExists < Minitest::Test
|
|
32
32
|
def test_check_vm_extension_exists_exception
|
33
33
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) }
|
34
34
|
@vm_extension.stub :get, response do
|
35
|
-
assert_raises(
|
35
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.check_vm_extension_exists('fog-test-rg', 'fog-test-vm', 'fog-test-extension') }
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -71,7 +71,7 @@ class TestCreateAvailabilitySet < Minitest::Test
|
|
71
71
|
|
72
72
|
@availability_sets.stub :validate_params, true do
|
73
73
|
@availability_sets.stub :create_or_update, response do
|
74
|
-
assert_raises(
|
74
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.create_availability_set(avail_set_params) }
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
@@ -105,7 +105,7 @@ class TestCreateAvailabilitySet < Minitest::Test
|
|
105
105
|
|
106
106
|
@availability_sets.stub :validate_params, true do
|
107
107
|
@availability_sets.stub :create_or_update, response do
|
108
|
-
assert_raises(
|
108
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.create_availability_set(avail_set_params) }
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
@@ -19,7 +19,7 @@ class TestCreateImage < Minitest::Test
|
|
19
19
|
def test_create_image_failure
|
20
20
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
21
21
|
@image.stub :create_or_update, response do
|
22
|
-
assert_raises
|
22
|
+
assert_raises MsRestAzure::AzureOperationError do
|
23
23
|
@service.create_image(@input_params)
|
24
24
|
end
|
25
25
|
end
|
@@ -31,7 +31,7 @@ class TestCreateManagedDisk < Minitest::Test
|
|
31
31
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
32
32
|
@managed_disks.stub :validate_params, true do
|
33
33
|
@managed_disks.stub :create_or_update, response do
|
34
|
-
assert_raises(
|
34
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.create_or_update_managed_disk(@disk) }
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -96,7 +96,7 @@ class TestCreateVirtualMachine < Minitest::Test
|
|
96
96
|
def test_create_virtual_machine_failure
|
97
97
|
@virtual_machines.stub :create_or_update, @error_response do
|
98
98
|
@virtual_machines.stub :get, @error_response do
|
99
|
-
assert_raises
|
99
|
+
assert_raises MsRestAzure::AzureOperationError do
|
100
100
|
@service.create_virtual_machine(@linux_virtual_machine_hash)
|
101
101
|
end
|
102
102
|
end
|
@@ -105,7 +105,7 @@ class TestCreateVirtualMachine < Minitest::Test
|
|
105
105
|
# Async
|
106
106
|
@virtual_machines.stub :create_or_update_async, @error_response do
|
107
107
|
@virtual_machines.stub :get, @error_response do
|
108
|
-
assert_raises
|
108
|
+
assert_raises MsRestAzure::AzureOperationError do
|
109
109
|
@service.create_virtual_machine(@linux_virtual_machine_hash, true)
|
110
110
|
end
|
111
111
|
end
|
@@ -27,7 +27,7 @@ class TestCreateVMExtension < Minitest::Test
|
|
27
27
|
def test_create_vm_extension_failure
|
28
28
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
29
29
|
@vm_extension.stub :create_or_update, response do
|
30
|
-
assert_raises
|
30
|
+
assert_raises MsRestAzure::AzureOperationError do
|
31
31
|
@service.create_or_update_vm_extension(@vm_extension_params)
|
32
32
|
end
|
33
33
|
end
|
@@ -22,11 +22,11 @@ class TestDeallocateVirtualMachine < Minitest::Test
|
|
22
22
|
def test_deallocate_virtual_machine_failure
|
23
23
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
24
24
|
@virtual_machines.stub :deallocate, response do
|
25
|
-
assert_raises(
|
25
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.deallocate_virtual_machine('fog-test-rg', 'fog-test-server', false) }
|
26
26
|
end
|
27
27
|
|
28
28
|
@virtual_machines.stub :deallocate_async, response do
|
29
|
-
assert_raises(
|
29
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.deallocate_virtual_machine('fog-test-rg', 'fog-test-server', true) }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -17,7 +17,7 @@ class TestDeleteAvailabilitySet < Minitest::Test
|
|
17
17
|
def test_delete_availability_set_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@availability_sets.stub :delete, response do
|
20
|
-
assert_raises(
|
20
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.delete_availability_set('fog-test-rg', 'fog-test-as') }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -17,7 +17,7 @@ class TestDeleteImage < Minitest::Test
|
|
17
17
|
def test_delete_image_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@image.stub :delete, response do
|
20
|
-
assert_raises(
|
20
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.delete_image('fog-test-rg', 'fog-test-server-osImage') }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -17,7 +17,7 @@ class TestDeleteManagedDisk < Minitest::Test
|
|
17
17
|
def test_delete_managed_disk_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@managed_disks.stub :delete, response do
|
20
|
-
assert_raises(
|
20
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.delete_managed_disk('fog-test-rg', 'test-disk') }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -22,11 +22,11 @@ class TestDeleteVirtualMachine < Minitest::Test
|
|
22
22
|
def test_delete_virtual_machine_failure
|
23
23
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
24
24
|
@virtual_machines.stub :delete, response do
|
25
|
-
assert_raises(
|
25
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.delete_virtual_machine('fog-test-rg', 'fog-test-server', false) }
|
26
26
|
end
|
27
27
|
|
28
28
|
@virtual_machines.stub :delete_async, response do
|
29
|
-
assert_raises(
|
29
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.delete_virtual_machine('fog-test-rg', 'fog-test-server', true) }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -23,7 +23,7 @@ class TestDetachDataDiskFromVM < Minitest::Test
|
|
23
23
|
update_vm_response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
24
24
|
@virtual_machines.stub :get, get_vm_response do
|
25
25
|
@virtual_machines.stub :create_or_update, update_vm_response do
|
26
|
-
assert_raises
|
26
|
+
assert_raises MsRestAzure::AzureOperationError do
|
27
27
|
@service.detach_data_disk_from_vm('fog-test-rg', 'fog-test-vm', 'mydatadisk1', false)
|
28
28
|
end
|
29
29
|
end
|
@@ -22,11 +22,11 @@ class TestGeneralizeVirtualMachine < Minitest::Test
|
|
22
22
|
def test_generalize_virtual_machine_failure
|
23
23
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
24
24
|
@virtual_machines.stub :generalize, response do
|
25
|
-
assert_raises(
|
25
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.generalize_virtual_machine('fog-test-rg', 'fog-test-server', false) }
|
26
26
|
end
|
27
27
|
|
28
28
|
@virtual_machines.stub :generalize_async, response do
|
29
|
-
assert_raises(
|
29
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.generalize_virtual_machine('fog-test-rg', 'fog-test-server', true) }
|
30
30
|
end
|
31
31
|
end
|
32
32
|
end
|
@@ -18,7 +18,7 @@ class TestGetAvailabilitySet < Minitest::Test
|
|
18
18
|
def test_list_availability_set_failure
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@availability_sets.stub :get, response do
|
21
|
-
assert_raises(
|
21
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.get_availability_set('myrg1', 'myavset1') }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -17,7 +17,7 @@ class TestGetImage < Minitest::Test
|
|
17
17
|
def test_get_image_failure
|
18
18
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
19
19
|
@image.stub :get, response do
|
20
|
-
assert_raises(
|
20
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.get_image('fog-test-rg', 'TestImage') }
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
@@ -18,7 +18,7 @@ class TestGetManagedDisk < Minitest::Test
|
|
18
18
|
def test_get_managed_disk_failure
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@managed_disks.stub :get, response do
|
21
|
-
assert_raises(
|
21
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.get_managed_disk('myrg1', 'disk1') }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -18,7 +18,7 @@ class TestGetVirtualMachine < Minitest::Test
|
|
18
18
|
def test_get_virtual_machine_failure
|
19
19
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@virtual_machines.stub :get, response do
|
21
|
-
assert_raises(
|
21
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.get_virtual_machine('fog-test-rg', 'fog-test-server', false) }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -18,7 +18,7 @@ class TestGetVMExtension < Minitest::Test
|
|
18
18
|
def test_update_vm_extension_failure
|
19
19
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
20
20
|
@vm_extension.stub :get, response do
|
21
|
-
assert_raises
|
21
|
+
assert_raises MsRestAzure::AzureOperationError do
|
22
22
|
@service.get_vm_extension('fog-test-rg', 'fog-test-vm', 'fog-test-extension')
|
23
23
|
end
|
24
24
|
end
|
@@ -19,7 +19,7 @@ class TestGetVirtualMachineStatus < Minitest::Test
|
|
19
19
|
def test_vm_status_failure
|
20
20
|
response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
21
21
|
@virtual_machines.stub :get, response do
|
22
|
-
assert_raises(
|
22
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.check_vm_status('fog-test-rg', 'fog-test-server', false) }
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
@@ -20,7 +20,7 @@ class TestGrantAccessToManagedDisk < Minitest::Test
|
|
20
20
|
def test_grant_access_to_managed_disk_failure
|
21
21
|
response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
|
22
22
|
@managed_disks.stub :grant_access, response do
|
23
|
-
assert_raises(
|
23
|
+
assert_raises(MsRestAzure::AzureOperationError) { @service.grant_access_to_managed_disk('myrg1', 'disk1', 'Read', 100) }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|