jellyfish-manageiq 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +202 -0
  3. data/README.md +109 -0
  4. data/Rakefile +25 -0
  5. data/app/assets/images/jellyfish_manageiq/products/apache.png +0 -0
  6. data/app/assets/images/jellyfish_manageiq/products/aws_ec2.png +0 -0
  7. data/app/assets/images/jellyfish_manageiq/products/aws_rds.png +0 -0
  8. data/app/assets/images/jellyfish_manageiq/products/aws_s3.png +0 -0
  9. data/app/assets/images/jellyfish_manageiq/products/bugzilla.png +0 -0
  10. data/app/assets/images/jellyfish_manageiq/products/confluence.png +0 -0
  11. data/app/assets/images/jellyfish_manageiq/products/database.png +0 -0
  12. data/app/assets/images/jellyfish_manageiq/products/dna.png +0 -0
  13. data/app/assets/images/jellyfish_manageiq/products/exchange.png +0 -0
  14. data/app/assets/images/jellyfish_manageiq/products/f5.png +0 -0
  15. data/app/assets/images/jellyfish_manageiq/products/firewall.png +0 -0
  16. data/app/assets/images/jellyfish_manageiq/products/hadoop.png +0 -0
  17. data/app/assets/images/jellyfish_manageiq/products/java.png +0 -0
  18. data/app/assets/images/jellyfish_manageiq/products/jira.png +0 -0
  19. data/app/assets/images/jellyfish_manageiq/products/kb.png +0 -0
  20. data/app/assets/images/jellyfish_manageiq/products/man.png +0 -0
  21. data/app/assets/images/jellyfish_manageiq/products/mean.png +0 -0
  22. data/app/assets/images/jellyfish_manageiq/products/mssql.png +0 -0
  23. data/app/assets/images/jellyfish_manageiq/products/netapp.png +0 -0
  24. data/app/assets/images/jellyfish_manageiq/products/oracle.png +0 -0
  25. data/app/assets/images/jellyfish_manageiq/products/php.png +0 -0
  26. data/app/assets/images/jellyfish_manageiq/products/postgresql.png +0 -0
  27. data/app/assets/images/jellyfish_manageiq/products/rails.png +0 -0
  28. data/app/assets/images/jellyfish_manageiq/products/redhat.png +0 -0
  29. data/app/assets/images/jellyfish_manageiq/products/teradata.png +0 -0
  30. data/app/assets/images/jellyfish_manageiq/products/ubuntu.png +0 -0
  31. data/app/assets/images/jellyfish_manageiq/products/windows.png +0 -0
  32. data/app/assets/images/jellyfish_manageiq/products/woman.png +0 -0
  33. data/app/assets/javascripts/jellyfish_manageiq/application.js +13 -0
  34. data/app/assets/javascripts/jellyfish_manageiq/products_admin_controller.js +63 -0
  35. data/app/assets/stylesheets/jellyfish_manageiq/application.css +15 -0
  36. data/app/controllers/manageiq/automate_controller.rb +61 -0
  37. data/app/controllers/manageiq/order_items_controller.rb +64 -0
  38. data/app/helpers/application_helper.rb +2 -0
  39. data/app/models/manage_iq_client.rb +12 -0
  40. data/app/models/manage_iq_client/base.rb +61 -0
  41. data/app/models/manage_iq_client/cluster.rb +9 -0
  42. data/app/models/manage_iq_client/datastore.rb +9 -0
  43. data/app/models/manage_iq_client/host.rb +9 -0
  44. data/app/models/manage_iq_client/policy.rb +9 -0
  45. data/app/models/manage_iq_client/policy_profile.rb +9 -0
  46. data/app/models/manage_iq_client/provider.rb +9 -0
  47. data/app/models/manage_iq_client/resource.rb +82 -0
  48. data/app/models/manage_iq_client/resource_pool.rb +9 -0
  49. data/app/models/manage_iq_client/server.rb +34 -0
  50. data/app/models/manage_iq_client/service.rb +9 -0
  51. data/app/models/manage_iq_client/service_catalog.rb +9 -0
  52. data/app/models/manage_iq_client/service_template.rb +9 -0
  53. data/app/models/manage_iq_client/template.rb +25 -0
  54. data/app/models/manage_iq_client/virtual_machine.rb +27 -0
  55. data/app/models/manage_iq_client/zone.rb +9 -0
  56. data/app/policies/manageiq/order_item_policy.rb +16 -0
  57. data/app/views/manageiq/automate/catalog_item_initialization.html.erb +0 -0
  58. data/app/views/manageiq/automate/create_chef_node.html.erb +97 -0
  59. data/app/views/manageiq/automate/create_ec2.html.erb +140 -0
  60. data/app/views/manageiq/automate/create_rds.html.erb +146 -0
  61. data/app/views/manageiq/automate/create_s3.html.erb +100 -0
  62. data/app/views/manageiq/automate/create_ses.html.erb +114 -0
  63. data/app/views/manageiq/automate/create_vmware_vm.html.erb +102 -0
  64. data/app/views/manageiq/automate/provision_rds.html.erb +130 -0
  65. data/app/views/manageiq/automate/retire_ec2.html.erb +96 -0
  66. data/app/views/manageiq/automate/retire_rds.html.erb +117 -0
  67. data/app/views/manageiq/automate/retire_s3.html.erb +93 -0
  68. data/app/views/manageiq/automate/retire_ses.html.erb +98 -0
  69. data/app/views/manageiq/automate/retire_vmware_vm.html.erb +70 -0
  70. data/app/views/manageiq/automate/update_servicemix_and_chef.html.erb +364 -0
  71. data/config/initializers/manage_iq_client.rb +9 -0
  72. data/config/initializers/product_types.rb +6 -0
  73. data/config/initializers/provisioners.rb +9 -0
  74. data/config/initializers/task_scheduler.rb +12 -0
  75. data/config/product_questions/big_data.json +50 -0
  76. data/config/product_questions/database.json +79 -0
  77. data/config/product_questions/infrastructure.json +49 -0
  78. data/config/product_questions/storage.json +57 -0
  79. data/config/provisioners.json +6 -0
  80. data/config/routes.rb +38 -0
  81. data/db/migrate/20150513221625_create_jellyfish_manageiq_database_products.rb +16 -0
  82. data/db/migrate/20150513221938_create_jellyfish_manageiq_big_data_products.rb +14 -0
  83. data/db/migrate/20150513222020_create_jellyfish_manageiq_infrastructure_products.rb +13 -0
  84. data/db/migrate/20150513222056_create_jellyfish_manageiq_storage_products.rb +13 -0
  85. data/lib/jellyfish/manageiq.rb +34 -0
  86. data/lib/jellyfish/manageiq/big_data.rb +6 -0
  87. data/lib/jellyfish/manageiq/databases.rb +6 -0
  88. data/lib/jellyfish/manageiq/engine.rb +19 -0
  89. data/lib/jellyfish/manageiq/infrastructure.rb +6 -0
  90. data/lib/jellyfish/manageiq/provisioner.rb +115 -0
  91. data/lib/jellyfish/manageiq/storage.rb +6 -0
  92. data/lib/jellyfish/manageiq/version.rb +5 -0
  93. data/lib/tasks/pollvms.rake +42 -0
  94. metadata +360 -0
@@ -0,0 +1,25 @@
1
+ module ManageIQClient
2
+ class Template
3
+ include ManageIQClient::Resource
4
+
5
+ self.path = '/api/templates'
6
+
7
+ attribute :id, String
8
+ attribute :name, String
9
+ attribute :type, String
10
+ attribute :guid, String
11
+ attribute :vendor, String
12
+ attribute :location, String
13
+ attribute :uid_ems, String
14
+ attribute :power_state, String
15
+ attribute :state_changed_on, String
16
+ attribute :template, Boolean
17
+ attribute :ems_ref, String
18
+ attribute :cloud, Boolean
19
+ attribute :raw_power_state, String
20
+ attribute :publicly_available, Boolean
21
+
22
+ attribute :created_on, DateTime
23
+ attribute :updated_on, DateTime
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ module ManageIQClient
2
+ class VirtualMachine
3
+ include ManageIQClient::Resource
4
+
5
+ self.path = '/api/vms'
6
+
7
+ attribute :id, String
8
+ attribute :name, String
9
+ attribute :type, String
10
+ attribute :guid, String
11
+ attribute :vendor, String
12
+ attribute :location, String
13
+ attribute :uid_ems, String
14
+ attribute :power_state, String
15
+ attribute :state_changed_on, String
16
+ attribute :ems_ref, String
17
+ attribute :cloud, Boolean
18
+ attribute :raw_power_state, String
19
+ attribute :flavor_id, Integer
20
+ attribute :availability_zone_id, Integer
21
+ attribute :cloud_network_id, Integer
22
+ attribute :cloud_subnet_id, Integer
23
+
24
+ attribute :created_on, DateTime
25
+ attribute :updated_on, DateTime
26
+ end
27
+ end
@@ -0,0 +1,9 @@
1
+ module ManageIQClient
2
+ class Zone
3
+ include ManageIQClient::Resource
4
+
5
+ self.path = '/api/zones'
6
+
7
+ attribute :id, Integer
8
+ end
9
+ end
@@ -0,0 +1,16 @@
1
+ module Manageiq
2
+ class OrderItemPolicy < ::OrderItemPolicy
3
+ def start_service?
4
+ admin_or_related
5
+ end
6
+
7
+ def stop_service?
8
+ admin_or_related
9
+ end
10
+
11
+ def provision_update?
12
+ ap user
13
+ user.admin?
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,97 @@
1
+ # This script uses the Chef gem and the Chef Server API
2
+ # To create a new node, assign it an IP Address and role
3
+
4
+ require 'chef'
5
+ require 'net/http'
6
+ require 'chef/http'
7
+ require 'json'
8
+
9
+ def send_order_status(referer, headers, status, information, message = '')
10
+ order_id = information[:id]
11
+ $evm.log('info', "send_order_status: Got order_id: #{order_id}")
12
+ path = "/order_items/#{order_id}/provision_update"
13
+ host = URI.parse(referer).host
14
+ url = "http://#{host}#{path}"
15
+ uri = URI.parse(url)
16
+
17
+ information = information.merge('provision_status' => status.downcase)
18
+ $evm.log('info', "send_order_status: Information: #{information}")
19
+ json = {
20
+ status: "#{status}",
21
+ message: "#{message}",
22
+ info: information
23
+ }
24
+ $evm.log('info', "send_order_status: Information #{json}")
25
+ begin
26
+ http = Net::HTTP.new(uri.host, uri.port)
27
+ request = Net::HTTP::Put.new(uri.path)
28
+ request.add_field('X-Staff-Email', "#{headers[0]}")
29
+ request.add_field('X-Staff-Token', "#{headers[1]}")
30
+ request.content_type = 'application/json'
31
+ request.body = json.to_json
32
+ response = http.request(request)
33
+ $evm.log('info', "send_order_status: HTTP Response code: #{response.code}")
34
+ $evm.log('info', "send_order_status: HTTP Response message: #{response.message}")
35
+ rescue StandardError => e
36
+ $evm.log('error', "send_order_status: Exception caught while sending response back to core: #{e.message}")
37
+ end
38
+ end # End of function
39
+
40
+ # Retrieve properties from payload from core
41
+ product_details = $evm.root['dialog_order_item']
42
+ order_item_hash = JSON.parse(product_details.gsub("'", '"').gsub('=>', ':'))
43
+ product_hash = order_item_hash['product_details']
44
+ order_id = order_item_hash['id']
45
+ uuid = order_item_hash['uuid']
46
+ $evm.log('info', "chef_automation: Product Details: #{product_details}")
47
+ ip_address = product_hash['ip_address']
48
+ $evm.log('info', "chef_automation: ip address #{ip_address}")
49
+ exit if product_hash['chef_role'].empty? || product_hash['chef_role'].nil?
50
+ chef_role = product_hash['chef_role']
51
+ $evm.log('info', 'chef_automation: chef role was not nil.')
52
+ $evm.log('info', "chef_automation: chef role #{chef_role}")
53
+ chef_run_list = product_hash['chef_run_list']
54
+ referer = $evm.root['dialog_referer']
55
+ headers = [$evm.root['dialog_email'], $evm.root['dialog_token']]
56
+
57
+ info = {
58
+ uuid: uuid,
59
+ id: order_id
60
+ }
61
+
62
+ # This is the standard location for the chef client file
63
+ # on a server
64
+ begin
65
+ Chef::Config.from_file('//etc/chef/client.rb')
66
+ rescue StandardError => e
67
+ send_order_status(referer, headers, 'CRITICAL', info, e.message)
68
+ $evm.log('error', 'chef_automation: Did not create the node.')
69
+ exit
70
+ end
71
+
72
+ hash = {
73
+ 'name' => "#{ip_address}",
74
+ 'chef_environment' => '_default',
75
+ 'json_class' => 'Chef::Node',
76
+ 'automatic' => {
77
+ 'ipaddress' => "#{ip_address}",
78
+ 'recipes' => [],
79
+ 'roles' => ["#{chef_role}"]
80
+ },
81
+ 'normal' => {},
82
+ 'chef_type' => 'node',
83
+ 'default' => {},
84
+ 'override' => {},
85
+ 'run_list' => ["#{chef_run_list}"]
86
+ }
87
+
88
+ begin
89
+ node = Chef::Node
90
+ new_node = node.json_create(hash)
91
+ new_node.create
92
+ rescue StandardError => e
93
+ send_order_status(referer, headers, 'CRITICAL', info, e.message)
94
+ $evm.log('error', 'chef_automation: Did not create the node.')
95
+ exit
96
+ end
97
+ $evm.log('info', 'chef_automation: Created the node.')
@@ -0,0 +1,140 @@
1
+ # Description: This MIQ Method will create a new Amazon EC2 instance
2
+ # from the criteria selected in the marketplace
3
+ # For use in Service/Provisioning/StateMachines/Methods/CreateEC2
4
+
5
+ require 'aws-sdk'
6
+ require 'net/http'
7
+ require 'uri/http'
8
+ require 'json'
9
+
10
+ def send_order_status(referer, headers, status, order_id, information, message = '')
11
+ path = "/order_items/#{order_id}/provision_update"
12
+ host = URI.parse(referer).host
13
+ url = "http://#{host}#{path}"
14
+ uri = URI.parse(url)
15
+
16
+ information = information.merge('provision_status' => status.downcase)
17
+ $evm.log('info', "send_order_status: Information: #{information}")
18
+ json = {
19
+ status: "#{status}",
20
+ message: "#{message}",
21
+ info: information
22
+ }
23
+ $evm.log('info', "send_order_status: Information #{json}")
24
+ begin
25
+ http = Net::HTTP.new(uri.host, uri.port)
26
+ request = Net::HTTP::Put.new(uri.path)
27
+ request.add_field('X-Staff-Email', "#{headers[0]}")
28
+ request.add_field('X-Staff-Token', "#{headers[1]}")
29
+ request.content_type = 'application/json'
30
+ request.body = json.to_json
31
+ response = http.request(request)
32
+ $evm.log('info', "send_order_status: HTTP Response code: #{response.code}")
33
+ $evm.log('info', "send_order_status: HTTP Response message: #{response.message}")
34
+ rescue StandardError => e
35
+ $evm.log('error', "send_order_status: Exception caught while sending response back to core: #{e.message}")
36
+ end
37
+ end # End of function
38
+
39
+ # Retrieve properties from request
40
+ # MIQ makes product_details into a string.
41
+ # Must make into a hash
42
+ product_details = $evm.root['dialog_order_item']
43
+ order_item_hash = JSON.parse(product_details.gsub("'", '"').gsub('=>', ':'))
44
+ product_hash = order_item_hash['product_details']
45
+ order_id = order_item_hash['id']
46
+ uuid = order_item_hash['uuid']
47
+ access_key_id = product_hash['access_key_id']
48
+ secret_access_key = product_hash['secret_access_key']
49
+ image_id = product_hash['image_id']
50
+ instance_type = product_hash['instance_type']
51
+ count = product_hash['count']
52
+ availability_zone = product_hash['availability_zone']
53
+ security_groups = product_hash['security_groups']
54
+ key_name = product_hash['key_name']
55
+ instance_name = product_hash['instance_name']
56
+ host = $evm.root['dialog_referer']
57
+ headers = [$evm.root['dialog_email'], $evm.root['dialog_token']]
58
+
59
+ # Configure AWS
60
+ AWS.config(
61
+ access_key_id: access_key_id,
62
+ secret_access_key: secret_access_key
63
+ )
64
+
65
+ # Create the new EC2 instance
66
+ ec2 = AWS::EC2.new
67
+
68
+ # Create the hash of options for the specified VM
69
+ options = {
70
+ image_id: image_id,
71
+ instance_type: instance_type,
72
+ count: count,
73
+ availability_zone: availability_zone,
74
+ security_groups: security_groups,
75
+ key_name: key_name
76
+ }
77
+
78
+ # Remove all empty strings from the options list
79
+ # to avoid error in creation of EC2 instance
80
+ options.each do |key, value|
81
+ options.delete(key) if value == '' || value.nil?
82
+ end
83
+
84
+ $evm.log('info', "CreateEC2: Options: #{options}")
85
+
86
+ begin
87
+ info = {
88
+ 'id' => order_id,
89
+ 'uuid' => uuid
90
+ }
91
+ instance = ec2.instances.create(options)
92
+ rescue AWS::EC2::Errors::InvalidClientTokenId => e
93
+ $evm.log('error', "CreateEC2: Invalid client token exception. Message: #{e.message}")
94
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
95
+ exit
96
+ rescue AWS::EC2::Errors::InvalidParameterValue => e
97
+ $evm.log('error', "CreateEC2: Invalid parameter exception. Message: #{e.message}")
98
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
99
+ exit
100
+ rescue StandardError => e
101
+ $evm.log('error', "CreateEC2: Could not create instance. Error: #{e}")
102
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
103
+ exit
104
+ end
105
+
106
+ # Amazon needs ~5 seconds before the instance can be accessed
107
+ # From the time it is initially created.
108
+ sleep 5
109
+ sleep 5 while instance.status == :pending if instance.exists?
110
+
111
+ # Return all of the properties inside of a JSON Response
112
+ # But first just print them all out
113
+
114
+ info = {
115
+ 'id' => order_id,
116
+ 'uuid' => uuid,
117
+ 'instance_name' => instance_name,
118
+ 'order_item' => order_id,
119
+ 'architecture' => instance.architecture,
120
+ 'dns_name' => instance.dns_name,
121
+ 'id' => instance.id,
122
+ 'image_id' => instance.image_id,
123
+ 'instance_type' => instance.instance_type,
124
+ 'ip_address' => instance.ip_address,
125
+ 'key_name' => instance.key_name,
126
+ 'launch_time' => instance.launch_time,
127
+ 'owner_id' => instance.owner_id,
128
+ 'platform' => instance.platform,
129
+ 'private_ip_address' => instance.private_ip_address,
130
+ 'root_device_name' => instance.root_device_name,
131
+ 'root_device_type' => instance.root_device_type,
132
+ 'instance' => instance.status,
133
+ 'subnet_id' => instance.subnet_id,
134
+ 'virtualization_type' => instance.virtualization_type,
135
+ 'vpc_id' => instance.vpc_id
136
+ }
137
+
138
+ response = send_order_status(host, headers, 'OK', order_id, info)
139
+
140
+ $evm.log('info', "CreateEC2: Response = #{response}")
@@ -0,0 +1,146 @@
1
+ # Description: This MIQ Method
2
+ # provisions a new Amazon RDS Instance from the
3
+ # Criteria selected in the marketplace
4
+
5
+ # For use in MIQ under the
6
+ # For use in Service/Provisioning/StateMachines/Methods/CreateRDS
7
+
8
+ require 'aws-sdk'
9
+ require 'securerandom'
10
+
11
+ require 'net/http'
12
+ require 'uri/http'
13
+ require 'json'
14
+
15
+ def send_order_status(referer, headers, status, order_id, information, message = '')
16
+ path = "/order_items/#{order_id}/provision_update"
17
+ host = URI.parse(referer).host
18
+ url = "http://#{host}#{path}"
19
+ uri = URI.parse(url)
20
+
21
+ information = information.merge('provision_status' => status.downcase)
22
+ $evm.log('info', "send_order_status: Information: #{information}")
23
+ json = {
24
+ status: "#{status}",
25
+ message: "#{message}",
26
+ info: information
27
+ }
28
+ $evm.log('info', "send_order_status: Information #{json}")
29
+ begin
30
+ http = Net::HTTP.new(uri.host, uri.port)
31
+ request = Net::HTTP::Put.new(uri.path)
32
+ request.add_field('X-Staff-Email', "#{headers[0]}")
33
+ request.add_field('X-Staff-Token', "#{headers[1]}")
34
+ request.content_type = 'application/json'
35
+ request.body = json.to_json
36
+ response = http.request(request)
37
+ $evm.log('info', "send_order_status: HTTP Response code: #{response.code}")
38
+ $evm.log('info', "send_order_status: HTTP Response message: #{response.message}")
39
+ rescue StandardError => e
40
+ $evm.log('error', "send_order_status: Exception caught while sending response back to core: #{e.message}")
41
+ end
42
+ end # End of function
43
+
44
+ # Retrieve properties from request
45
+ # MIQ makes product_details into a string.
46
+ # Must make into a hash
47
+ product_details = $evm.root['dialog_order_item']
48
+ order_item_hash = JSON.parse(product_details.gsub("'", '"').gsub('=>', ':'))
49
+ product_hash = order_item_hash['product_details']
50
+ order_id = order_item_hash['id']
51
+ uuid = order_item_hash['uuid']
52
+ allocated_storage = Integer(product_hash['allocated_storage'])
53
+ db_instance_class = product_hash['db_instance_class']
54
+ engine = product_hash['engine']
55
+ username = 'admin'
56
+ storage_type = product_hash['storage_type']
57
+ security_groups_init = product_hash['security_groups']
58
+ db_instance_id = "id-#{uuid[0..9]}"
59
+ $evm.root['db_instance_id'] = db_instance_id
60
+ access_key_id = product_hash['access_key_id']
61
+ secret_key = product_hash['secret_access_key']
62
+ host = $evm.root['dialog_referer']
63
+ headers = [$evm.root['dialog_email'], $evm.root['dialog_token']]
64
+
65
+ $evm.log('info', "CreateRDS: Processing order Id #{order_id}")
66
+ $evm.log('info', "CreateRDS: Processing db_instance_id #{db_instance_id}")
67
+
68
+ rds = AWS::RDS.new(
69
+ access_key_id: access_key_id,
70
+ secret_access_key: secret_key
71
+ )
72
+
73
+ # Create password to pass back to the Marketplace
74
+ # AWS RDS instance passwords require a minimum of 8 characters
75
+ sec_pw = SecureRandom.hex
76
+ sec_pw = sec_pw[0..9] # First 10 characters
77
+ $evm.log('info', "CreateRDS: Created password #{sec_pw}")
78
+
79
+ # Set the secure password
80
+ $evm.root['root_sec_pw'] = sec_pw
81
+
82
+ security_groups = !security_groups_init.nil? ? security_groups_init : ''
83
+ unless security_groups.nil?
84
+ security_array = security_groups.split(',')
85
+ security_array.each do |security|
86
+ $evm.log('info', "CreateRDS: Security group= #{security}")
87
+ end
88
+ end
89
+
90
+ options = {
91
+ allocated_storage: allocated_storage,
92
+ db_instance_class: db_instance_class,
93
+ engine: engine,
94
+ master_username: username,
95
+ master_user_password: sec_pw,
96
+ storage_type: storage_type,
97
+ vpc_security_group_ids: security_array
98
+ }
99
+
100
+ # Remove all empty strings from the options list
101
+ # to avoid error in creation of RDS instance
102
+ options.each do |key, value|
103
+ options.delete(key) if value == '' || value.nil?
104
+ end
105
+
106
+ $evm.log('info', "CreateRDS: Set options for new RDS instance: #{options}")
107
+
108
+ # Create instance
109
+ begin
110
+ info = {
111
+ 'id' => order_id,
112
+ 'uuid' => uuid
113
+ }
114
+ $evm.log('info', "CreateRDS: info hash = #{info}")
115
+ rds.db_instances.create(db_instance_id, options)
116
+ rescue AWS::RDS::Errors::InvalidClientTokenId => e
117
+ $evm.log('error', "CreateRDS: Exception caught when creating instance: #{e.message}")
118
+ $evm.root['instance_failed'] = true
119
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
120
+ exit
121
+ rescue AWS::RDS::Errors::DBInstanceAlreadyExists => e
122
+ $evm.log('error', "CreateRDS: Instance exists exception: #{e.message}")
123
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
124
+ $evm.root['instance_failed'] = true
125
+ exit
126
+ rescue AWS::RDS::Errors::InvalidParameterValue => e
127
+ $evm.log('error', "CreateRDS: Invalid parameter exception: #{e.message}")
128
+ $evm.root['instance_failed'] = true
129
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
130
+ exit
131
+ rescue AWS::RDS::Errors::StorageTypeNotSupported => e
132
+ $evm.log('error', "CreateRDS: Unsupported storage exception: #{e.message}")
133
+ $evm.root['instance_failed'] = true
134
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
135
+ exit
136
+ rescue AWS::RDS::Errors => e
137
+ $evm.log('error', "CreateRDS: Exception caught when creating instance: #{e.message}")
138
+ $evm.root['instance_failed'] = true
139
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
140
+ exit
141
+ rescue StandardError => e
142
+ $evm.log('error', "CreateRDS: General exception caught: #{e.message}")
143
+ $evm.root['instance_failed'] = true
144
+ send_order_status(host, headers, 'CRITICAL', order_id, info, "#{e.message}")
145
+ exit
146
+ end