avst-cloud 0.1.17 → 0.1.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/avst-cloud.gemspec +1 -1
- data/lib/avst-cloud/azure_rm_connection.rb +49 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjlhMDcyNDIwYTI2OGMxYzI3NDk3NGVlZjJkYjRkMWE3MWVjM2QxMw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YjRlOTJhODcwZjZkNDc5MDUwZDFiZDEzYmJiM2Y0ZGExM2U0YTQ2Ng==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTViZTQ1ZmYyZDZlYzFkZjJkNjk5NzM1ODU3ZWNlOWI4YTk1ODc0OTA0NWVl
|
10
|
+
NjI1NDZjYmM4YTNjNDI1MzYyYTAwYTkxMTM2NTg3MDcyYTY2ZTNkYTBhODky
|
11
|
+
OGI4ODQ3NGEzYmI5NWY1MDI0ZmM2OWZmN2Q5ZTM0NGYyMGMxN2Q=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NmUxODY3MTZjODRhNDdkNmIzNWJiZmYwZGM4M2JhYTQ4ZjYwYmUzODVkN2Yz
|
14
|
+
OWRmOGIxZWI1M2YzNjcyN2QzMTYzY2Y3ZjVlMmFiNGQzNDUzYzZmNTkyYzdm
|
15
|
+
OTE0YzdkOGIxYzYwZGJkMTA2YTNjNTAxNTg2OTdhY2M4ZWYzMzY=
|
data/avst-cloud.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "avst-cloud"
|
7
|
-
spec.version = '0.1.
|
7
|
+
spec.version = '0.1.18'
|
8
8
|
spec.authors = ["Martin Brehovsky", "Jon Bevan", "Matthew Hope"]
|
9
9
|
spec.email = ["mbrehovsky@adaptavist.com", "jbevan@adaptavist.com", "mhope@adaptavist.com"]
|
10
10
|
spec.summary = %q{Automated creation, bootstrapping and provisioning of servers }
|
@@ -87,6 +87,7 @@ module AvstCloud
|
|
87
87
|
address_prefix,
|
88
88
|
use_public_ip,
|
89
89
|
create_public_ip_configuration,
|
90
|
+
availability_set_name=nil,
|
90
91
|
storage_account_resource_group=nil,
|
91
92
|
virtual_network_resource_group=nil,
|
92
93
|
network_interface_resource_group=nil,
|
@@ -119,6 +120,7 @@ module AvstCloud
|
|
119
120
|
logger.debug "sku - #{sku}"
|
120
121
|
logger.debug "version - #{version}"
|
121
122
|
logger.debug "platform - #{platform}"
|
123
|
+
logger.debug "availability_set_name- #{availability_set_name}"
|
122
124
|
|
123
125
|
storage_account_resource_group = resource_group unless storage_account_resource_group
|
124
126
|
virtual_network_resource_group = resource_group unless virtual_network_resource_group
|
@@ -135,6 +137,8 @@ module AvstCloud
|
|
135
137
|
# Check that storage_account exists if not create one
|
136
138
|
check_create_storage_account(storage_account_name, location, storage_account_resource_group)
|
137
139
|
|
140
|
+
availability_set_id = availability_set_name ? check_create_availability_set(availability_set_name, resource_group, location).id : nil
|
141
|
+
|
138
142
|
# Check if network_interface_card_id exists if not create one
|
139
143
|
# If not, create one for virtual network provided with subnet, security group and also public ip name
|
140
144
|
ip_address = check_create_network_interface(network_interface_name, network_interface_resource_group, location, virtual_network_name, subnet_name, ip_configuration_name, private_ip_allocation_method, public_ip_allocation_method, subnet_address_list, dns_list, network_address_list, address_prefix, use_public_ip, create_public_ip_configuration, virtual_network_resource_group, public_ip_resource_group, subnet_resource_group)
|
@@ -154,7 +158,8 @@ module AvstCloud
|
|
154
158
|
offer: offer,
|
155
159
|
sku: sku,
|
156
160
|
version: version,
|
157
|
-
platform: platform
|
161
|
+
platform: platform,
|
162
|
+
availability_set_id: availability_set_id
|
158
163
|
)
|
159
164
|
|
160
165
|
result_server = AvstCloud::AzureRmServer.new(server, server_name, ip_address, user, password)
|
@@ -452,6 +457,49 @@ module AvstCloud
|
|
452
457
|
logger.debug "Storage deleted"
|
453
458
|
end
|
454
459
|
|
460
|
+
def check_create_availability_set(availability_set_name, resource_group, location)
|
461
|
+
logger.debug "Searching for #{resource_group}"
|
462
|
+
found_availability_set = connect.availability_sets(resource_group: resource_group).get(resource_group, availability_set_name)
|
463
|
+
unless found_availability_set
|
464
|
+
logger.debug "Availability set #{availability_set_name} in #{resource_group} not found, creating new one"
|
465
|
+
found_availability_set = connect.availability_sets.create(
|
466
|
+
name: availability_set_name,
|
467
|
+
location: location,
|
468
|
+
resource_group: resource_group
|
469
|
+
)
|
470
|
+
end
|
471
|
+
found_availability_set
|
472
|
+
end
|
473
|
+
|
474
|
+
def find_availability_set_name_for_server(server_name, resource_group, should_fail=true)
|
475
|
+
availability_set_name = nil
|
476
|
+
server = find_fog_server(server_name, resource_group)
|
477
|
+
if (server.availability_set_id)
|
478
|
+
availability_set_name = server.availability_set_id.split("/")[-1]
|
479
|
+
else
|
480
|
+
logger.debug "Can not find availability_set_id for server #{server_name} in resource_group #{resource_group}"
|
481
|
+
raise "Can not find availability_set_id" if should_fail
|
482
|
+
end
|
483
|
+
availability_set_name
|
484
|
+
end
|
485
|
+
|
486
|
+
def list_availability_sets(resource_group)
|
487
|
+
availability_sets = connect.availability_sets(resource_group: resource_group)
|
488
|
+
availability_sets.each do |availability_set|
|
489
|
+
logger.debug "#{availability_set.id}"
|
490
|
+
logger.debug "#{availability_set.name}"
|
491
|
+
logger.debug "#{availability_set.location}"
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
def destroy_availability_set(availability_set_name, resource_group)
|
496
|
+
logger.debug "Deleting #{resource_group}"
|
497
|
+
found_availability_set = connect.availability_sets(resource_group: resource_group).get(resource_group, availability_set_name)
|
498
|
+
if found_availability_set
|
499
|
+
found_availability_set.destroy
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
455
503
|
def check_create_resource_group(resource_group, location)
|
456
504
|
logger.debug "Searching for #{resource_group}"
|
457
505
|
found_resource_group = connect_to_resources.resource_groups.get(resource_group)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avst-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Brehovsky
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-07-
|
13
|
+
date: 2016-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|