jellyfish-fog 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/azure.rb +8 -0
- data/config/product_questions/{database.json → aws_database.json} +0 -0
- data/config/product_questions/{infrastructure.json → aws_infrastructure.json} +0 -0
- data/config/product_questions/{storage.json → aws_storage.json} +0 -0
- data/config/product_questions/azure_infrastructure.json +4 -4
- data/lib/jellyfish_fog/infrastructure.rb +29 -8
- data/lib/jellyfish_fog/provisioner.rb +4 -0
- data/lib/jellyfish_fog/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d04e61608cc847611bbdbc2b46cc2ab0e225d4f1
|
4
|
+
data.tar.gz: 4fe07b73bbe512316d6c235918ea7fb67e6c03b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1237e4605d6390e0aa705607099cd4003ac5b3e445b2fc66b628eac76cf5a5369afa421f9953ff059481cb09a08e4c5ff51da994f53498f8120a2eceef188570
|
7
|
+
data.tar.gz: a70b5bbc020d18b39a9463e545c48ff535b8109f4e64ff54e93fc094184e1be4fac8087ef93ac0d9be6217f8bd4669d2fcc660f0d2aad7c741eae64a03fa4718
|
@@ -0,0 +1,8 @@
|
|
1
|
+
require 'azure'
|
2
|
+
|
3
|
+
Azure.configure do |config|
|
4
|
+
# Configure these 3 properties to use Storage
|
5
|
+
config.management_certificate = ENV['JELLYFISH_AZURE_PEM_PATH']
|
6
|
+
config.subscription_id = ENV['JELLYFISH_AZURE_SUB_ID']
|
7
|
+
config.management_endpoint = ENV['JELLYFISH_AZURE_API_URL']
|
8
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,7 +7,7 @@
|
|
7
7
|
"image" :{
|
8
8
|
"title": "Image ID",
|
9
9
|
"type": "string",
|
10
|
-
"default": "
|
10
|
+
"default": "a699494373c04fc0bc8f2bb1389d6106__Win2K8R2SP1-Datacenter-201504.01-en.us-127GB.vhd"
|
11
11
|
},
|
12
12
|
"location" : {
|
13
13
|
"title": "Location",
|
@@ -17,12 +17,12 @@
|
|
17
17
|
"vm_name" :{
|
18
18
|
"title": "VM Name",
|
19
19
|
"type": "string",
|
20
|
-
"default": "
|
20
|
+
"default": "fogvmclone"
|
21
21
|
},
|
22
22
|
"vm_user" :{
|
23
23
|
"title": "VM User",
|
24
24
|
"type": "string",
|
25
|
-
"default": "
|
25
|
+
"default": "jellyfish"
|
26
26
|
},
|
27
27
|
|
28
28
|
"password" :{
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"storage_account_name" :{
|
34
34
|
"title": "Storage Account Name",
|
35
35
|
"type": "string",
|
36
|
-
"default": "
|
36
|
+
"default": "fogvmclonestorage"
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}
|
@@ -10,7 +10,7 @@ module Jellyfish
|
|
10
10
|
end
|
11
11
|
|
12
12
|
server['new_vm'] = server['new_vm'].except('parent')
|
13
|
-
@order_item.provision_status =
|
13
|
+
@order_item.provision_status = :ok
|
14
14
|
@order_item.payload_response = server.to_json
|
15
15
|
end
|
16
16
|
|
@@ -31,7 +31,7 @@ module Jellyfish
|
|
31
31
|
server = connection.servers.create(details).tap { |s| s.wait_for { ready? } }
|
32
32
|
end
|
33
33
|
|
34
|
-
@order_item.provision_status =
|
34
|
+
@order_item.provision_status = :ok
|
35
35
|
@order_item.payload_response = server.to_json
|
36
36
|
end
|
37
37
|
|
@@ -39,7 +39,7 @@ module Jellyfish
|
|
39
39
|
handle_errors do
|
40
40
|
connection.servers.delete(server_identifier)
|
41
41
|
end
|
42
|
-
@order_item.provision_status =
|
42
|
+
@order_item.provision_status = :retired
|
43
43
|
end
|
44
44
|
|
45
45
|
private
|
@@ -58,20 +58,41 @@ module Jellyfish
|
|
58
58
|
class Infrastructure < Jellyfish::Provisioner
|
59
59
|
def provision
|
60
60
|
server = nil
|
61
|
+
current_vm = nil
|
61
62
|
|
62
63
|
handle_errors do
|
64
|
+
# CREATE THE AZURE VM CLONE
|
63
65
|
server = connection.servers.create(details)
|
66
|
+
|
67
|
+
# LOOK UP VMS ASSOCIATED WITH AZURE SUBSCRIPTION
|
68
|
+
azure_vmms = ::Azure::VirtualMachineManagementService.new
|
69
|
+
vms = azure_vmms.list_virtual_machines
|
70
|
+
|
71
|
+
# LOCATE THE VM JUST CREATED
|
72
|
+
# vms.each { |vm| current_vm = vm if vm.vm_name == details['vm_name'] }
|
73
|
+
vms.each do |vm|
|
74
|
+
current_vm = vm if vm.vm_name == details[:vm_name]
|
75
|
+
end
|
64
76
|
end
|
65
77
|
|
66
|
-
|
67
|
-
|
78
|
+
# POPULATE PAYLOAD RESPONSE TEMPLATE
|
79
|
+
payload_response = payload_response_template
|
80
|
+
payload_response[:raw] = server.attributes
|
81
|
+
|
82
|
+
# INCLUDE IPADDRESS AND HOSTANME IF THEY EXIST
|
83
|
+
payload_response[:defaults][:ip_address] = current_vm.ipaddress unless current_vm.ipaddress.nil?
|
84
|
+
payload_response[:defaults][:hostname] = current_vm.hostname unless current_vm.hostname.nil?
|
85
|
+
|
86
|
+
# UPDATE ORDER ITEM - SET STATUS TO CRITICAL IF CANNOT LOCATE IPADDRESS
|
87
|
+
@order_item.provision_status = current_vm.ipaddress.nil? ? :warning : :ok
|
88
|
+
@order_item.payload_response = payload_response
|
68
89
|
end
|
69
90
|
|
70
91
|
def retire
|
71
92
|
handle_errors do
|
72
|
-
connection.delete_virtual_machine(server_attributes[
|
93
|
+
connection.delete_virtual_machine(server_attributes['vm_name'], server_attributes['cloud_service_name'])
|
73
94
|
end
|
74
|
-
order_item.provision_status = :retired
|
95
|
+
@order_item.provision_status = :retired
|
75
96
|
end
|
76
97
|
|
77
98
|
private
|
@@ -81,7 +102,7 @@ module Jellyfish
|
|
81
102
|
end
|
82
103
|
|
83
104
|
def server_attributes
|
84
|
-
order_item.payload_response
|
105
|
+
@order_item.payload_response['raw']
|
85
106
|
end
|
86
107
|
end
|
87
108
|
end
|
@@ -18,6 +18,10 @@ module Jellyfish
|
|
18
18
|
order_item.answers
|
19
19
|
end
|
20
20
|
|
21
|
+
def payload_response_template
|
22
|
+
{ defaults: { ip_address: '127.0.0.1', hostname: 'TBD', total: '0.0' }, raw: nil }
|
23
|
+
end
|
24
|
+
|
21
25
|
def self.perform(order_item_id, error_method)
|
22
26
|
order_item = OrderItem.find(order_item_id)
|
23
27
|
yield order_item
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jellyfish-fog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mafernando
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -132,13 +132,14 @@ files:
|
|
132
132
|
- LICENSE
|
133
133
|
- README.md
|
134
134
|
- Rakefile
|
135
|
+
- config/initializers/azure.rb
|
135
136
|
- config/initializers/fog.rb
|
136
137
|
- config/initializers/product_types.rb
|
137
138
|
- config/initializers/provisioners.rb
|
139
|
+
- config/product_questions/aws_database.json
|
140
|
+
- config/product_questions/aws_infrastructure.json
|
141
|
+
- config/product_questions/aws_storage.json
|
138
142
|
- config/product_questions/azure_infrastructure.json
|
139
|
-
- config/product_questions/database.json
|
140
|
-
- config/product_questions/infrastructure.json
|
141
|
-
- config/product_questions/storage.json
|
142
143
|
- config/product_questions/vmware_infrastructure.json
|
143
144
|
- config/provisioners.json
|
144
145
|
- lib/jellyfish-fog.rb
|