fog-azure-rm 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 731aaa338eaa0b86ea9c2b9e2e838e16411d03a9
4
- data.tar.gz: 6915b60d50f07eab248c59e24a67b85320344cc1
3
+ metadata.gz: 9b24d2c21a6e6802af2ca763b1230cb7a7d75acc
4
+ data.tar.gz: 1a176bf88ef73639cf5c4cceafdebfb13f676d28
5
5
  SHA512:
6
- metadata.gz: 7a16c8f7733e70238b55f8238a52d6dafccb988cb222fc7d96f9bea6ba90608689c7aa1cd972c737a600ff8b85c68870a845f25f89c8dd2a824e8275ceaf8afc
7
- data.tar.gz: 4eab5acba5b78ad74eed791a1573175c9ff37a49a0688933b9a47a75290ae54fbb01fd2e64657a68faf39b52bcd36e6a1ac4e9e5f4d462be4ed7ac551fa45c00
6
+ metadata.gz: 57b1cd6b6c20875fcd62db652f45818741b6fb37bd855250881ea261a50b401900dea6851384565642fa9cb492030aac6f4e3708135fe03bd69525c9bee6a3de
7
+ data.tar.gz: e730e48874f042e56027233ee84167ae48cdb38fbc96c02a49ecf9aaddee839bbdcf4953fb88b9a8087d80cb6a3262d1bd8296a403ec3b237a8592c8be39833d
@@ -1,3 +1,12 @@
1
+ ## 0.2.6
2
+
3
+ **Fixed:**
4
+ - Compute Service - storage_account_name attribute issue in server model
5
+ - Network Service - Attaching NSG issue while creating NIC
6
+
7
+ **Removed:**
8
+ - Dependency on nokogiri
9
+
1
10
  ## 0.2.5
2
11
 
3
12
  **Fixed:**
@@ -35,5 +35,4 @@ Gem::Specification.new do |spec|
35
35
  spec.add_dependency 'azure_mgmt_key_vault', '~> 0.8.0'
36
36
  spec.add_dependency 'azure-storage', '~> 0.11.5.preview'
37
37
  spec.add_dependency 'vhd', '0.0.4'
38
- spec.add_dependency 'nokogiri', '~> 1.6.0'
39
38
  end
@@ -41,6 +41,7 @@ module Fog
41
41
  unless vm.storage_profile.nil?
42
42
  hash['os_disk_name'] = vm.storage_profile.os_disk.name
43
43
  hash['os_disk_vhd_uri'] = vm.storage_profile.os_disk.vhd.uri
44
+ hash['storage_account_name'] = hash['os_disk_vhd_uri'].split('/')[2].split('.')[0]
44
45
  hash['os_disk_caching'] = vm.storage_profile.os_disk.caching
45
46
  unless vm.storage_profile.image_reference.nil?
46
47
  hash['publisher'] = vm.storage_profile.image_reference.publisher
@@ -62,14 +62,14 @@ module Fog
62
62
  requires :subnet_id
63
63
  requires :ip_configuration_name
64
64
  requires :private_ip_allocation_method
65
- nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, ip_configuration_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
65
+ nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_configuration_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
66
66
  merge_attributes(Fog::Network::AzureRM::NetworkInterface.parse(nic))
67
67
  end
68
68
 
69
69
  def update(updated_attributes = {})
70
70
  validate_update_attributes!(updated_attributes)
71
71
  merge_attributes(updated_attributes)
72
- nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, ip_configuration_name, private_ip_allocation_method, private_ip_address)
72
+ nic = service.create_or_update_network_interface(resource_group, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_configuration_name, private_ip_allocation_method, private_ip_address)
73
73
  merge_attributes(Fog::Network::AzureRM::NetworkInterface.parse(nic))
74
74
  end
75
75
 
@@ -4,10 +4,10 @@ module Fog
4
4
  class AzureRM
5
5
  # Real class for Network Request
6
6
  class Real
7
- def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
7
+ def create_or_update_network_interface(resource_group_name, name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
8
8
  msg = "Creating/Updating Network Interface Card: #{name}"
9
9
  Fog::Logger.debug msg
10
- network_interface = get_network_interface_object(name, location, subnet_id, public_ip_address_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
10
+ network_interface = get_network_interface_object(name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
11
11
  begin
12
12
  network_interface_obj = @network_client.network_interfaces.create_or_update(resource_group_name, name, network_interface)
13
13
  rescue MsRestAzure::AzureOperationError => e
@@ -19,10 +19,7 @@ module Fog
19
19
 
20
20
  private
21
21
 
22
- def get_network_interface_object(name, location, subnet_id, public_ip_address_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
23
- subnet = Azure::ARM::Network::Models::Subnet.new
24
- subnet.id = subnet_id
25
-
22
+ def get_network_interface_object(name, location, subnet_id, public_ip_address_id, network_security_group_id, ip_config_name, private_ip_allocation_method, private_ip_address, load_balancer_backend_address_pools_ids, load_balancer_inbound_nat_rules_ids)
26
23
  if public_ip_address_id
27
24
  public_ipaddress = Azure::ARM::Network::Models::PublicIPAddress.new
28
25
  public_ipaddress.id = public_ip_address_id
@@ -33,16 +30,20 @@ module Fog
33
30
  ip_configs.private_ipallocation_method = private_ip_allocation_method
34
31
  ip_configs.private_ipaddress = private_ip_address
35
32
  ip_configs.public_ipaddress = public_ipaddress unless public_ip_address_id.nil?
36
- ip_configs.subnet = subnet
37
33
 
34
+ if subnet_id
35
+ subnet = Azure::ARM::Network::Models::Subnet.new
36
+ subnet.id = subnet_id
37
+ ip_configs.subnet = subnet
38
+ end
38
39
 
39
40
  if load_balancer_backend_address_pools_ids
40
41
  ip_configs.load_balancer_backend_address_pools = []
41
- load_balancer_backend_address_pools_ids.each do |load_balancer_backend_address_pools_id|
42
+ load_balancer_backend_address_pools_ids.each do |load_balancer_backend_address_pools_id|
42
43
  backend_pool = Azure::ARM::Network::Models::BackendAddressPool.new
43
44
  backend_pool.id = load_balancer_backend_address_pools_id
44
45
  ip_configs.load_balancer_backend_address_pools.push(backend_pool)
45
- end
46
+ end
46
47
  end
47
48
 
48
49
  if load_balancer_inbound_nat_rules_ids
@@ -59,6 +60,12 @@ module Fog
59
60
  network_interface.location = location
60
61
  network_interface.ip_configurations = [ip_configs]
61
62
 
63
+ if network_security_group_id
64
+ network_security_group = Azure::ARM::Network::Models::NetworkSecurityGroup.new
65
+ network_security_group.id = network_security_group_id
66
+ network_interface.network_security_group = network_security_group
67
+ end
68
+
62
69
  network_interface
63
70
  end
64
71
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module AzureRM
3
- VERSION = '0.2.5'.freeze
3
+ VERSION = '0.2.6'.freeze
4
4
  end
5
5
  end
@@ -67,7 +67,7 @@ begin
67
67
  public_ip_allocation_method: 'Dynamic'
68
68
  )
69
69
 
70
- network.network_security_groups.create(
70
+ nsg = network.network_security_groups.create(
71
71
  name: 'test_nsg',
72
72
  resource_group: 'TestRG-NI',
73
73
  location: LOCATION,
@@ -102,6 +102,7 @@ begin
102
102
  name: 'NetInt',
103
103
  resource_group: 'TestRG-NI',
104
104
  location: LOCATION,
105
+ network_security_group_id: nsg.id,
105
106
  subnet_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-NI/providers/Microsoft.Network/virtualNetworks/testVnet/subnets/mysubnet",
106
107
  public_ip_address_id: "/subscriptions/#{azure_credentials['subscription_id']}/resourceGroups/TestRG-NI/providers/Microsoft.Network/publicIPAddresses/mypubip",
107
108
  ip_configuration_name: 'testIpConfiguration',
@@ -11,14 +11,14 @@ class TestCreateNetworkInterface < Minitest::Test
11
11
  def test_create_network_interface_success
12
12
  mocked_response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
13
13
  @network_interfaces.stub :create_or_update, mocked_response do
14
- assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
14
+ assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-nsg-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
15
15
  end
16
16
  end
17
17
 
18
18
  def test_create_network_interface_without_public_ip_success
19
19
  mocked_response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
20
20
  @network_interfaces.stub :create_or_update, mocked_response do
21
- assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', nil, 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
21
+ assert_equal @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', nil, 'fog-test-nsg-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2']), mocked_response
22
22
  end
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ class TestCreateNetworkInterface < Minitest::Test
26
26
  response = ApiStub::Requests::Network::NetworkInterface.create_network_interface_response(@network_client)
27
27
  @network_interfaces.stub :create_or_update, response do
28
28
  assert_raises ArgumentError do
29
- @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', ['id-1', 'id-2'], ['id-1', 'id-2'])
29
+ @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-nsg-id', 'fog-test-ip-configuration', ['id-1', 'id-2'], ['id-1', 'id-2'])
30
30
  end
31
31
  end
32
32
  end
@@ -35,7 +35,7 @@ class TestCreateNetworkInterface < Minitest::Test
35
35
  response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
36
36
  @network_interfaces.stub :create_or_update, response do
37
37
  assert_raises RuntimeError do
38
- @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2'])
38
+ @service.create_or_update_network_interface('fog-test-rg', 'fog-test-network-interface', 'West US', 'fog-test-subnet-id', 'fog-test-ip-address-id', 'fog-test-nsg-id', 'fog-test-ip-configuration', 'Dynamic', '10.0.0.8', ['id-1', 'id-2'], ['id-1', 'id-2'])
39
39
  end
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-azure-rm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaffan Chaudhry
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2017-01-20 00:00:00.000000000 Z
17
+ date: 2017-01-30 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: rake
@@ -254,20 +254,6 @@ dependencies:
254
254
  - - '='
255
255
  - !ruby/object:Gem::Version
256
256
  version: 0.0.4
257
- - !ruby/object:Gem::Dependency
258
- name: nokogiri
259
- requirement: !ruby/object:Gem::Requirement
260
- requirements:
261
- - - "~>"
262
- - !ruby/object:Gem::Version
263
- version: 1.6.0
264
- type: :runtime
265
- prerelease: false
266
- version_requirements: !ruby/object:Gem::Requirement
267
- requirements:
268
- - - "~>"
269
- - !ruby/object:Gem::Version
270
- version: 1.6.0
271
257
  description: |-
272
258
  This library can be used as a module for 'fog' or as standalone provider
273
259
  to use the Azure Resource Manager cloud services in applications..