Merge "Fixing three mistakes, plus missing durability steps."
This commit is contained in:
commit
eedebe3a69
@ -38,7 +38,7 @@ instance = conn.servers.create name: "app-database",
|
|||||||
key_name: key_pair.name,
|
key_name: key_pair.name,
|
||||||
security_groups: db_group
|
security_groups: db_group
|
||||||
|
|
||||||
Fog.wait_for { instance.ready? }
|
instance.wait_for { ready? }
|
||||||
|
|
||||||
# step-5
|
# step-5
|
||||||
volume = conn.volumes.get "755ab026-b5f2-4f53-b34a-6d082fb36689"
|
volume = conn.volumes.get "755ab026-b5f2-4f53-b34a-6d082fb36689"
|
||||||
|
@ -28,7 +28,7 @@ p swift.directories.all
|
|||||||
# step-4
|
# step-4
|
||||||
file_path = "goat.jpg"
|
file_path = "goat.jpg"
|
||||||
object_name = "an amazing goat"
|
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)),
|
object = container.files.create body: File.read(File.expand_path(file_path)),
|
||||||
key: object_name
|
key: object_name
|
||||||
|
|
||||||
@ -48,6 +48,8 @@ object.destroy
|
|||||||
p container.files.all
|
p container.files.all
|
||||||
|
|
||||||
# step-10
|
# step-10
|
||||||
|
container_name = 'fractals'
|
||||||
|
container = swift.directories.get container_name
|
||||||
|
|
||||||
# step-11
|
# step-11
|
||||||
endpoint = "http://IP_API_1"
|
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 = JSON.parse(Net::HTTP.get_response(uri).body)
|
||||||
|
|
||||||
data["objects"].each do |fractal|
|
data["objects"].each do |fractal|
|
||||||
uri = URI("#{endpoint}/fractal/#{fractal["uuid"]}")
|
body = open("#{endpoint}/fractal/#{fractal["uuid"]}") {|f| f.read}
|
||||||
#TBC
|
object = container.files.create body: body, key: fractal["uuid"]
|
||||||
end
|
end
|
||||||
|
|
||||||
p container.files.all
|
p container.files.all
|
||||||
@ -70,13 +72,14 @@ container.destroy
|
|||||||
|
|
||||||
# step-13
|
# step-13
|
||||||
object_name = "backup_goat.jpg"
|
object_name = "backup_goat.jpg"
|
||||||
|
file_path = "backup_goat.jpg"
|
||||||
extra = {
|
extra = {
|
||||||
meta_data: {
|
description: "a funny goat",
|
||||||
description: "a funny goat",
|
created: "2015-06-02"
|
||||||
created: "2015-06-02"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#TBC
|
object = container.files.create body: File.read(File.expand_path(file_path)),
|
||||||
|
key: object_name,
|
||||||
|
metadata: extra
|
||||||
|
|
||||||
# step-14
|
# step-14
|
||||||
#TBC
|
#TBC
|
||||||
|
@ -33,7 +33,7 @@ testing_instance = conn.servers.create name: instance_name,
|
|||||||
image_ref: image.id,
|
image_ref: image.id,
|
||||||
flavor_ref: flavor.id
|
flavor_ref: flavor.id
|
||||||
|
|
||||||
Fog.wait_for {testing_instance.ready?}
|
testing_instance.wait_for { ready? }
|
||||||
|
|
||||||
p testing_instance
|
p testing_instance
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ else
|
|||||||
user_data: user_data,
|
user_data: user_data,
|
||||||
security_groups: all_in_one_security_group
|
security_groups: all_in_one_security_group
|
||||||
|
|
||||||
Fog.wait_for {testing_instance.ready?}
|
testing_instance.wait_for { ready? }
|
||||||
end
|
end
|
||||||
|
|
||||||
p conn.servers.summary
|
p conn.servers.summary
|
||||||
|
@ -13,7 +13,7 @@ testing_instance = conn.servers.create name: instance_name,
|
|||||||
user_data: user_data,
|
user_data: user_data,
|
||||||
security_groups: all_in_one_security_group
|
security_groups: all_in_one_security_group
|
||||||
|
|
||||||
Fog.wait_for {testing_instance.ready?}
|
testing_instance.wait_for { ready? }
|
||||||
|
|
||||||
# step-2
|
# step-2
|
||||||
user_data = <<END
|
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
|
unused_floating_ip_address = conn.addresses.create pool: pool_name
|
||||||
|
|
||||||
# step-10
|
# step-10
|
||||||
unused_floating_ip_address.server = instance
|
unused_floating_ip_address.server = testing_instance
|
||||||
|
|
||||||
# step-11
|
# step-11
|
||||||
worker_group = conn.security_groups.create name: "worker",
|
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,
|
user_data: user_data,
|
||||||
security_groups: controller_group
|
security_groups: controller_group
|
||||||
|
|
||||||
Fog.wait_for {instance_controller_1.ready?}
|
instance_controller_1.wait_for { ready? }
|
||||||
|
|
||||||
puts "Checking for unused Floating IP..."
|
puts "Checking for unused Floating IP..."
|
||||||
unless unused_floating_ip_address = conn.addresses.find {|address| address.instance_id.nil?}
|
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,
|
user_data: user_data,
|
||||||
security_groups: worker_group
|
security_groups: worker_group
|
||||||
|
|
||||||
Fog.wait_for {instance_worker_1.ready?}
|
instance_worker_1.wait_for { ready? }
|
||||||
|
|
||||||
puts "Checking for unused Floating IP..."
|
puts "Checking for unused Floating IP..."
|
||||||
unless unused_floating_ip_address = conn.addresses.find {|address| address.instance_id.nil?}
|
unless unused_floating_ip_address = conn.addresses.find {|address| address.instance_id.nil?}
|
||||||
|
@ -119,7 +119,7 @@ instance_services = conn.servers.create name: "app-services",
|
|||||||
user_data: user_data,
|
user_data: user_data,
|
||||||
security_groups: services_group
|
security_groups: services_group
|
||||||
|
|
||||||
Fog.wait_for {instance_services.ready?}
|
instance_services.wait_for { ready? }
|
||||||
services_ip_address = instance_services.private_ip_address
|
services_ip_address = instance_services.private_ip_address
|
||||||
|
|
||||||
# step-5
|
# step-5
|
||||||
@ -143,9 +143,9 @@ instance_api_2 = conn.servers.create name: "app-api-2",
|
|||||||
user_data: user_data,
|
user_data: user_data,
|
||||||
security_groups: api_group
|
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
|
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
|
api_2_ip_address = instance_api_2.private_ip_address
|
||||||
|
|
||||||
[instance_api_1, instance_api_2].each do |instance|
|
[instance_api_1, instance_api_2].each do |instance|
|
||||||
|
Loading…
Reference in New Issue
Block a user