Fixing three mistakes, plus missing durability steps.

1) 'Fog#wait_for' hangs forever.

Using #wait_for directly on the instance model
is the right way to go.

2) Fixed incorrect variable name.

This was causing the IP assignment to fail.

3) Typo in durability

direcories.

4) Added steps for durability

Steps 10, 11, and 13.

Change-Id: Iffac65777e06fc36c5c815a7eef6c4e8523000a1
This commit is contained in:
Sean Handley 2016-07-19 14:28:45 +01:00
parent d6232812e0
commit e0acf333e9
5 changed files with 21 additions and 18 deletions

View File

@ -38,7 +38,7 @@ instance = conn.servers.create name: "app-database",
key_name: key_pair.name,
security_groups: db_group
Fog.wait_for { instance.ready? }
instance.wait_for { ready? }
# step-5
volume = conn.volumes.get "755ab026-b5f2-4f53-b34a-6d082fb36689"

View File

@ -28,7 +28,7 @@ p swift.directories.all
# step-4
file_path = "goat.jpg"
object_name = "an amazing goat"
container = swift.direcories.get container_name
container = swift.directories.get container_name
object = container.files.create body: File.read(File.expand_path(file_path)),
key: object_name
@ -48,6 +48,8 @@ object.destroy
p container.files.all
# step-10
container_name = 'fractals'
container = swift.directories.get container_name
# step-11
endpoint = "http://IP_API_1"
@ -56,8 +58,8 @@ uri.query = URI.encode_www_form results_per_page: -1
data = JSON.parse(Net::HTTP.get_response(uri).body)
data["objects"].each do |fractal|
uri = URI("#{endpoint}/fractal/#{fractal["uuid"]}")
#TBC
body = open("#{endpoint}/fractal/#{fractal["uuid"]}") {|f| f.read}
object = container.files.create body: body, key: fractal["uuid"]
end
p container.files.all
@ -70,13 +72,14 @@ container.destroy
# step-13
object_name = "backup_goat.jpg"
file_path = "backup_goat.jpg"
extra = {
meta_data: {
description: "a funny goat",
created: "2015-06-02"
}
description: "a funny goat",
created: "2015-06-02"
}
#TBC
object = container.files.create body: File.read(File.expand_path(file_path)),
key: object_name,
metadata: extra
# step-14
#TBC

View File

@ -33,7 +33,7 @@ testing_instance = conn.servers.create name: instance_name,
image_ref: image.id,
flavor_ref: flavor.id
Fog.wait_for {testing_instance.ready?}
testing_instance.wait_for { ready? }
p testing_instance
@ -107,7 +107,7 @@ else
user_data: user_data,
security_groups: all_in_one_security_group
Fog.wait_for {testing_instance.ready?}
testing_instance.wait_for { ready? }
end
p conn.servers.summary

View File

@ -13,7 +13,7 @@ testing_instance = conn.servers.create name: instance_name,
user_data: user_data,
security_groups: all_in_one_security_group
Fog.wait_for {testing_instance.ready?}
testing_instance.wait_for { ready? }
# step-2
user_data = <<END
@ -56,7 +56,7 @@ pool_name = conn.addresses.get_address_pools[0]["name"]
unused_floating_ip_address = conn.addresses.create pool: pool_name
# step-10
unused_floating_ip_address.server = instance
unused_floating_ip_address.server = testing_instance
# step-11
worker_group = conn.security_groups.create name: "worker",
@ -99,7 +99,7 @@ instance_controller_1 = conn.servers.create name: "app-controller",
user_data: user_data,
security_groups: controller_group
Fog.wait_for {instance_controller_1.ready?}
instance_controller_1.wait_for { ready? }
puts "Checking for unused Floating IP..."
unless unused_floating_ip_address = conn.addresses.find {|address| address.instance_id.nil?}
@ -128,7 +128,7 @@ instance_worker_1 = conn.servers.create name: "app-worker-1",
user_data: user_data,
security_groups: worker_group
Fog.wait_for {instance_worker_1.ready?}
instance_worker_1.wait_for { ready? }
puts "Checking for unused Floating IP..."
unless unused_floating_ip_address = conn.addresses.find {|address| address.instance_id.nil?}

View File

@ -119,7 +119,7 @@ instance_services = conn.servers.create name: "app-services",
user_data: user_data,
security_groups: services_group
Fog.wait_for {instance_services.ready?}
instance_services.wait_for { ready? }
services_ip_address = instance_services.private_ip_address
# step-5
@ -143,9 +143,9 @@ instance_api_2 = conn.servers.create name: "app-api-2",
user_data: user_data,
security_groups: api_group
Fog.wait_for {instance_api_1.ready?}
instance_api_1.wait_for { ready? }
api_1_ip_address = instance_api_1.private_ip_address
Fog.wait_for {instance_api_2.ready?}
instance_api_2.wait_for { ready? }
api_2_ip_address = instance_api_2.private_ip_address
[instance_api_1, instance_api_2].each do |instance|