bcome 0.7.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/bin/bcome +8 -39
  3. data/lib/bcome.rb +12 -3
  4. data/lib/objects/bcome/version.rb +3 -0
  5. data/lib/objects/bootup.rb +81 -0
  6. data/lib/objects/command/local.rb +40 -0
  7. data/lib/objects/config_factory.rb +36 -0
  8. data/lib/objects/driver/base.rb +30 -0
  9. data/lib/objects/driver/bucket.rb +20 -0
  10. data/lib/objects/driver/ec2.rb +44 -0
  11. data/lib/objects/driver/static.rb +4 -0
  12. data/lib/objects/exception/argument_error_invoking_method_from_command_line.rb +7 -0
  13. data/lib/objects/exception/base.rb +15 -0
  14. data/lib/objects/exception/can_only_subselect_on_inventory.rb +7 -0
  15. data/lib/objects/exception/cannot_find_internal_registry_klass.rb +7 -0
  16. data/lib/objects/exception/cannot_find_subselection_parent.rb +7 -0
  17. data/lib/objects/exception/cant_find_key_in_cloud_tags.rb +7 -0
  18. data/lib/objects/exception/cant_find_key_in_metadata.rb +7 -0
  19. data/lib/objects/exception/cant_find_proxy_host_by_identifier.rb +7 -0
  20. data/lib/objects/exception/cant_find_proxy_host_by_namespace.rb +7 -0
  21. data/lib/objects/exception/could_not_initiate_ssh_connection.rb +7 -0
  22. data/lib/objects/exception/could_not_initiate_ssh_connection_through_backend_proxy.rb +7 -0
  23. data/lib/objects/exception/deprecation_warning.rb +11 -0
  24. data/lib/objects/exception/duplicate_command_line_argument_key.rb +7 -0
  25. data/lib/objects/exception/ec2_driver_missing_provisioning_region.rb +7 -0
  26. data/lib/objects/exception/failed_to_run_local_command.rb +7 -0
  27. data/lib/objects/exception/interactive_session_halt.rb +4 -0
  28. data/lib/objects/exception/invalid_bcome_breadcrumb.rb +7 -0
  29. data/lib/objects/exception/invalid_breadcrumb.rb +7 -0
  30. data/lib/objects/exception/invalid_context_command.rb +7 -0
  31. data/lib/objects/exception/invalid_identifier.rb +7 -0
  32. data/lib/objects/exception/invalid_machines_cache_config.rb +7 -0
  33. data/lib/objects/exception/invalid_matcher_query.rb +7 -0
  34. data/lib/objects/exception/invalid_meta_data_config.rb +7 -0
  35. data/lib/objects/exception/invalid_network_config.rb +7 -0
  36. data/lib/objects/exception/invalid_network_driver_type.rb +7 -0
  37. data/lib/objects/exception/invalid_proxy_config.rb +7 -0
  38. data/lib/objects/exception/invalid_regexp_matcher_in_registry.rb +7 -0
  39. data/lib/objects/exception/invalid_registry_arguments_type.rb +7 -0
  40. data/lib/objects/exception/invalid_registry_data_config.rb +7 -0
  41. data/lib/objects/exception/invalid_restriction_key_in_registry.rb +7 -0
  42. data/lib/objects/exception/invalid_ssh_config.rb +7 -0
  43. data/lib/objects/exception/inventories_cannot_have_subviews.rb +7 -0
  44. data/lib/objects/exception/malformed_command_line_arguments.rb +7 -0
  45. data/lib/objects/exception/method_invocation_requires_parameter.rb +7 -0
  46. data/lib/objects/exception/method_name_conflict_in_registry.rb +7 -0
  47. data/lib/objects/exception/missing_argument_for_registry_command.rb +7 -0
  48. data/lib/objects/exception/missing_description_on_view.rb +7 -0
  49. data/lib/objects/exception/missing_execute_on_registry_object.rb +7 -0
  50. data/lib/objects/exception/missing_identifier_on_view.rb +7 -0
  51. data/lib/objects/exception/missing_ip_address_on_server.rb +7 -0
  52. data/lib/objects/exception/missing_network_config.rb +7 -0
  53. data/lib/objects/exception/missing_params_for_rsync.rb +7 -0
  54. data/lib/objects/exception/missing_params_for_scp.rb +7 -0
  55. data/lib/objects/exception/missing_subselection_key.rb +7 -0
  56. data/lib/objects/exception/missing_type_on_view.rb +7 -0
  57. data/lib/objects/exception/no_node_found_for_breadcrumb.rb +7 -0
  58. data/lib/objects/exception/no_node_named_by_identifier.rb +7 -0
  59. data/lib/objects/exception/node_identifiers_must_be_unique.rb +7 -0
  60. data/lib/objects/exception/orchestration_script_does_not_exist.rb +7 -0
  61. data/lib/objects/exception/proxy_host_node_does_not_have_public_ip_address.rb +7 -0
  62. data/lib/objects/exception/unknown_method_for_namespace.rb +7 -0
  63. data/lib/objects/interactive/session.rb +45 -0
  64. data/lib/objects/interactive/session_item/base.rb +36 -0
  65. data/lib/objects/interactive/session_item/capture_input.rb +20 -0
  66. data/lib/objects/interactive/session_item/transparent_ssh.rb +111 -0
  67. data/lib/objects/modules/context.rb +13 -0
  68. data/lib/objects/modules/registry_management.rb +14 -0
  69. data/lib/objects/modules/ui_output.rb +9 -0
  70. data/lib/objects/modules/workspace_commands.rb +198 -0
  71. data/lib/objects/modules/workspace_menu.rb +128 -0
  72. data/lib/objects/node/attributes.rb +47 -0
  73. data/lib/objects/node/base.rb +248 -0
  74. data/lib/objects/node/cache_handler.rb +24 -0
  75. data/lib/objects/node/collection.rb +51 -0
  76. data/lib/objects/node/factory.rb +108 -0
  77. data/lib/objects/node/inventory/base.rb +88 -0
  78. data/lib/objects/node/inventory/defined.rb +112 -0
  79. data/lib/objects/node/inventory/subselect.rb +54 -0
  80. data/lib/objects/node/meta/base.rb +36 -0
  81. data/lib/objects/node/meta/cloud.rb +4 -0
  82. data/lib/objects/node/meta/local.rb +4 -0
  83. data/lib/objects/node/meta_data_factory.rb +23 -0
  84. data/lib/objects/node/meta_data_loader.rb +32 -0
  85. data/lib/objects/node/resources/base.rb +98 -0
  86. data/lib/objects/node/resources/inventory.rb +25 -0
  87. data/lib/objects/node/resources/sub_inventory.rb +56 -0
  88. data/lib/objects/node/server/base.rb +218 -0
  89. data/lib/objects/node/server/dynamic.rb +39 -0
  90. data/lib/objects/node/server/static.rb +31 -0
  91. data/lib/objects/orchestration/base.rb +13 -0
  92. data/lib/objects/orchestrator.rb +24 -0
  93. data/lib/objects/parser/bread_crumb.rb +31 -0
  94. data/lib/objects/progress_bar.rb +30 -0
  95. data/lib/objects/registry/arguments/base.rb +36 -0
  96. data/lib/objects/registry/arguments/command_line.rb +35 -0
  97. data/lib/objects/registry/arguments/console.rb +15 -0
  98. data/lib/objects/registry/command/base.rb +66 -0
  99. data/lib/objects/registry/command/external.rb +55 -0
  100. data/lib/objects/registry/command/group.rb +76 -0
  101. data/lib/objects/registry/command/internal.rb +34 -0
  102. data/lib/objects/registry/command_list.rb +33 -0
  103. data/lib/objects/registry/loader.rb +70 -0
  104. data/lib/objects/ssh/bootstrap.rb +19 -0
  105. data/lib/objects/ssh/command.rb +46 -0
  106. data/lib/objects/ssh/command_exec.rb +65 -0
  107. data/lib/objects/ssh/connection_handler.rb +101 -0
  108. data/lib/objects/ssh/driver.rb +204 -0
  109. data/lib/objects/ssh/proxy_data.rb +56 -0
  110. data/lib/objects/ssh/script_exec.rb +43 -0
  111. data/lib/objects/system/local.rb +30 -0
  112. data/lib/objects/workspace.rb +75 -0
  113. data/patches/irb.rb +20 -7
  114. data/patches/string.rb +75 -0
  115. data/patches/string_stylesheet.rb +61 -0
  116. metadata +175 -93
  117. data/bin/bcome-bash-setup +0 -18
  118. data/bin/bcome-setup +0 -43
  119. data/bin/boot.rb +0 -148
  120. data/bin/boot_no_shell.rb +0 -3
  121. data/filters/ec2_filter.rb +0 -12
  122. data/lib/bcome/version.rb +0 -3
  123. data/lib/become_object.rb +0 -111
  124. data/lib/boot.rb +0 -13
  125. data/lib/command.rb +0 -56
  126. data/lib/context_functions.rb +0 -65
  127. data/lib/filters/base.rb +0 -10
  128. data/lib/filters/ec2_filter.rb +0 -4
  129. data/lib/functions.rb +0 -70
  130. data/lib/helpers/command_helper.rb +0 -13
  131. data/lib/helpers/environment_ssh.rb +0 -122
  132. data/lib/helpers/fog_helper.rb +0 -108
  133. data/lib/helpers/instance_command.rb +0 -71
  134. data/lib/helpers/instance_ssh.rb +0 -83
  135. data/lib/helpers/selections.rb +0 -117
  136. data/lib/interactive/interactive_session_halt.rb +0 -4
  137. data/lib/interactive/session.rb +0 -44
  138. data/lib/interactive/session_item/base.rb +0 -30
  139. data/lib/interactive/session_item/transparent_ssh.rb +0 -133
  140. data/lib/nodes/base.rb +0 -60
  141. data/lib/nodes/environment.rb +0 -30
  142. data/lib/nodes/estate.rb +0 -44
  143. data/lib/nodes/instance.rb +0 -94
  144. data/lib/nodes/platform.rb +0 -17
  145. data/lib/nodes/view.rb +0 -31
  146. data/lib/object.rb +0 -21
  147. data/lib/orchestrator/command_group/base.rb +0 -56
  148. data/lib/orchestrator/command_group/custom.rb +0 -13
  149. data/lib/orchestrator/command_group/direct.rb +0 -53
  150. data/lib/orchestrator/direct_command/group.rb +0 -21
  151. data/lib/orchestrator/direct_command/instance.rb +0 -19
  152. data/lib/orchestrator/factory.rb +0 -38
  153. data/lib/orchestrator/loader.rb +0 -47
  154. data/lib/orchestrator/node_target/all.rb +0 -14
  155. data/lib/orchestrator/node_target/all_excluding_roles.rb +0 -14
  156. data/lib/orchestrator/node_target/all_with_roles.rb +0 -14
  157. data/lib/orchestrator/node_target/base.rb +0 -43
  158. data/lib/orchestrator/node_target/single.rb +0 -12
  159. data/lib/orchestrator/recipe.rb +0 -60
  160. data/lib/orchestrator/registry.rb +0 -37
  161. data/lib/orchestrator/validate_and_set.rb +0 -10
  162. data/lib/patches/string.rb +0 -86
  163. data/lib/progress_bar.rb +0 -31
  164. data/lib/render_irb.rb +0 -53
  165. data/lib/scp.rb +0 -40
  166. data/lib/ssh.rb +0 -51
  167. data/lib/stack/base.rb +0 -148
  168. data/lib/stack/environment.rb +0 -222
  169. data/lib/stack/estate.rb +0 -50
  170. data/lib/stack/instance.rb +0 -130
  171. data/lib/stack/platform.rb +0 -74
  172. data/lib/stack/view.rb +0 -56
  173. data/lib/workspace_context.rb +0 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75e06da0e2c27915d8ca0a306ef24c0ce217c0f7
4
- data.tar.gz: ec8e78f0956c494335ea297d32f86917b827ce43
3
+ metadata.gz: 6b13dea68c96da6c50cd9f911836c141f6b27720
4
+ data.tar.gz: 9cbb87e356a39489d29dac89e2a5720131d442a2
5
5
  SHA512:
6
- metadata.gz: da2ca953c5f9d2c6d3778e68311f61b0e7e74f6cc512819c231d89595349f76e5beb25900888db306d4ea3f51cb3003ae83de1737547973d0e83cb94b3feea9e
7
- data.tar.gz: 7a7587be892d152d337f81b112926ed5c075391c27b80e92fa74571f2b2605c44f53af0c2a93532a2ae7b0f9a98dbbf8bf2c0ce46fa476526ac81f45ce435fa4
6
+ metadata.gz: ef0390c136034e31889cc7f18727340106f713448696403e163b33cf10b55d02a27d00123017a9c1b20055cade92ce23aa87fcd9a98e25b38a99e17e5211225b
7
+ data.tar.gz: 7be2d171f7e899da877709792b6f6750e5db8dc8477a4649eef4b44250cffbc52c6cc5542db9d351f5ae567c66552bbbe58e5d1545c71304d5b171f45cba4e72
data/bin/bcome CHANGED
@@ -1,46 +1,15 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # (C) Guillaume Roderick (webzakimbo)
4
- # MIT licence.
5
-
6
- ## Load & Boot into namespace
7
- require 'irb'
8
- require "irb/completion"
9
3
  require 'bcome'
10
4
 
11
- load Bcome::Boot.boot_path
12
-
13
- ## Load the shell
14
- unless @no_shell
15
- require 'irb/ext/multi-irb'
16
- IRB.parse_opts_with_ignoring_script
17
- irb_method = (@direct_command && @direct_shell_commands.include?(@direct_command)) ? @direct_command.to_sym : nil
18
- IRB.irb irb_method, @context_object
19
- end
5
+ begin
6
+ spawn_into_console = true
7
+ arguments = ARGV - [ARGV[0]]
8
+ ::Bcome::Bootup.set_and_do({ breadcrumbs: ARGV[0], arguments: arguments }, spawn_into_console)
20
9
 
21
- if @direct_command && @direct_command_on
22
- if @direct_command == "ssh"
23
- ## We're SSH'ing directly to a node, indicated by an 'ssh' key at the end of our context breadcrumb
24
- # called with, e.g. bcome platform:environment:node_name:ssh
25
- @direct_command_on.node.ssh
26
- elsif @direct_command == "run"
27
- ## We're directly excuting a command on a n node indicated by a 'run' key at the end of our context breadrumb
28
- # called with, e.g. bcome platform:environment:node_name:run "command to execute"
29
- params = ARGV[(1..(ARGV.size))].join("\s")
30
- @direct_command_on.node.run(params)
31
- else
32
- @direct_command_on.send(@direct_command)
33
- end
34
- end
10
+ # close any trailing connections
11
+ Bcome::Bootup.instance.estate.close_ssh_connections
35
12
 
36
- ## We're going to directly execute a command on a node, indicated by the method name at the end of our context breadcrumb.
37
- ## This works for commands specified in the users own personal framework installation, either from a context command or from an orchestration hook
38
- ## e,g, bcome platform:environment:node_name:bootstrap
39
- if @context_object && @direct_execute_method
40
- if ARGV && ARGV.size > 1
41
- arguments = ARGV[1..ARGV.size]
42
- @context_object.send(@direct_execute_method, arguments)
43
- else
44
- @context_object.send(@direct_execute_method)
45
- end
13
+ rescue ::Bcome::Exception::Base
14
+ puts "bcome terminated unexpectedly".warning
46
15
  end
data/lib/bcome.rb CHANGED
@@ -1,11 +1,20 @@
1
+ require 'irb'
2
+ require 'irb/completion'
1
3
  require 'rainbow'
2
- require 'aws-sdk'
3
4
  require 'net/scp'
4
5
  require 'net/ssh/proxy/command'
5
6
  require 'fog/aws'
6
7
  require 'require_all'
7
8
  require 'pmap'
9
+ require 'singleton'
10
+ require 'active_support'
11
+ require 'active_support/core_ext'
12
+ require 'pp'
13
+ require 'awesome_print'
8
14
 
9
- require_all "#{File.dirname(__FILE__)}/../lib"
10
- require_all "#{File.dirname(__FILE__)}/../filters"
15
+ require_all "#{File.dirname(__FILE__)}/../patches"
16
+ require_all "#{File.dirname(__FILE__)}/../lib/objects"
11
17
 
18
+ # Load in any user defined orchestration
19
+ path_to_bcome_orchestration_configs = "#{Dir.getwd}/bcome/orchestration"
20
+ require_all path_to_bcome_orchestration_configs if File.directory?(path_to_bcome_orchestration_configs)
@@ -0,0 +1,3 @@
1
+ module Bcome
2
+ VERSION = '1.0.0'.freeze
3
+ end
@@ -0,0 +1,81 @@
1
+ module Bcome
2
+ class Bootup
3
+ def self.set_and_do(params, spawn_into_console = true)
4
+ instance.set(params, spawn_into_console)
5
+ instance.do
6
+ rescue Bcome::Exception::Base => e
7
+ puts e.pretty_display
8
+ rescue Excon::Error::Socket => e
9
+ puts "\nNo network access - please check your connection and try again\n".red
10
+ end
11
+
12
+ def self.traverse(breadcrumbs = nil, _spawn_into_console = false)
13
+ spawn_into_console = false
14
+ ::Bcome::Bootup.set_and_do({ breadcrumbs: breadcrumbs }, spawn_into_console)
15
+ end
16
+
17
+ include Singleton
18
+
19
+ attr_reader :breadcrumbs, :arguments
20
+
21
+ def set(params, spawn_into_console = false)
22
+ @breadcrumbs = params[:breadcrumbs]
23
+ @arguments = params[:arguments]
24
+ @spawn_into_console = spawn_into_console
25
+ end
26
+
27
+ def do
28
+ context = crumbs.empty? ? init_context(estate) : traverse(estate)
29
+ context
30
+ end
31
+
32
+ def init_context(context)
33
+ if @spawn_into_console
34
+ ::Bcome::Workspace.instance.set(context: context)
35
+ else
36
+ context
37
+ end
38
+ end
39
+
40
+ def traverse(_starting_context)
41
+ starting_context = estate
42
+ crumbs.each_with_index do |crumb, _index|
43
+ # Some contexts' resources are loaded dynamically and do not come from the estate config. As we're traversing, we'll need to load
44
+ # them if necessary
45
+ starting_context.load_nodes if starting_context.inventory? && !starting_context.nodes_loaded?
46
+
47
+ # Attempt to load our next context resource
48
+ next_context = starting_context.resource_for_identifier(crumb)
49
+
50
+ # Our current breadcrumb is not a node, and so we'll attempt to invoke a method call on the previous
51
+ # e.g. given resource:foo, then invoke 'foo' on 'resource'
52
+ unless next_context
53
+ starting_context.invoke(crumb, @arguments)
54
+ return
55
+ end
56
+ starting_context = next_context
57
+ end
58
+
59
+ # Set our workspace to our last context - we're not invoking a method call and so we're entering a console session
60
+ init_context(starting_context)
61
+ end
62
+
63
+ def estate
64
+ @estate ||= ::Bcome::Node::Factory.instance.init_tree
65
+ end
66
+
67
+ def parser
68
+ ::Bcome::Parser::BreadCrumb.new(@breadcrumbs)
69
+ end
70
+
71
+ def crumbs
72
+ parser.crumbs
73
+ end
74
+
75
+ private
76
+
77
+ def teardown!
78
+ @estate = nil
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,40 @@
1
+ require 'open3'
2
+
3
+ module Bcome::Command
4
+ class Local
5
+ def self.run(raw_command, _success_exit_codes = [0])
6
+ command = new(raw_command)
7
+ command.syscall
8
+ command
9
+ end
10
+
11
+ attr_reader :stdout, :stderr
12
+
13
+ def initialize(command, success_exit_codes = [0])
14
+ @command = command
15
+ @success_exit_codes = success_exit_codes
16
+ end
17
+
18
+ def syscall
19
+ @stdout, @stderr, @process_status = Open3.capture3(@command)
20
+ rescue Exception => e
21
+ @stderr = e.message
22
+ end
23
+
24
+ def exit_code
25
+ @process_status ? @process_status.exitstatus : 1
26
+ end
27
+
28
+ def is_success?
29
+ @success_exit_codes.include?(exit_code)
30
+ end
31
+
32
+ def failed?
33
+ !is_success?
34
+ end
35
+
36
+ def pretty_result
37
+ is_success? ? "success / exit code: #{exit_code}".success : "failure / exit code: #{exit_code}".error
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ class Bcome::ConfigFactory
2
+ attr_reader :tree
3
+
4
+ def initialize
5
+ @tree = { views: [] }
6
+ @collections = []
7
+ end
8
+
9
+ def flattened
10
+ @tree[:views].first
11
+ end
12
+
13
+ def add_crumbs(crumbs, data)
14
+ views = @tree
15
+ number_crumbs = crumbs.size
16
+
17
+ crumbs.each_with_index do |crumb, index|
18
+ is_last_crumb = number_crumbs == (index + 1)
19
+ if this_view = hash_for_identifier_from_view(crumb, views)
20
+ views = this_view
21
+ else
22
+ this_view = { identifier: crumb }
23
+ this_view[:views] = [] unless is_last_crumb && data[:type].to_sym == :inventory
24
+ views[:views] << this_view
25
+ views = hash_for_identifier_from_view(crumb, views)
26
+ end
27
+
28
+ this_view.merge!(data) if is_last_crumb
29
+ end
30
+ end
31
+
32
+ def hash_for_identifier_from_view(identifier, views)
33
+ raise Bcome::Exception::InventoriesCannotHaveSubViews, 'Inventories cannot hold other inventories - invalid network config' unless views.key?(:views)
34
+ views[:views].select { |v| v[:identifier].to_s == identifier.to_s }.first
35
+ end
36
+ end
@@ -0,0 +1,30 @@
1
+ module Bcome::Driver
2
+ class Base
3
+ class << self
4
+ def create_from_config(config)
5
+ raise Bcome::Exception::InvalidNetworkDriverType, 'Your network configurtion is invalid' unless config.is_a?(Hash)
6
+ raise Bcome::Exception::InvalidNetworkDriverType, "Missing config parameter 'type'" unless config[:type]
7
+ config_klass_key = config[:type].to_sym
8
+ driver_klass = klass_for_type[config_klass_key]
9
+ raise Bcome::Exception::InvalidNetworkDriverType, config unless driver_klass
10
+ driver = driver_klass.new(config)
11
+ driver
12
+ end
13
+
14
+ def klass_for_type
15
+ {
16
+ static: ::Bcome::Driver::Static,
17
+ ec2: ::Bcome::Driver::Ec2
18
+ }
19
+ end
20
+ end
21
+
22
+ def initialize(params)
23
+ @params = params
24
+ end
25
+
26
+ def config
27
+ @params
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,20 @@
1
+ module Bcome::Driver
2
+ class Bucket
3
+ include Singleton
4
+
5
+ def initialize
6
+ @drivers = []
7
+ end
8
+
9
+ def driver_for_network_data(network_data)
10
+ found_driver = @drivers.select { |driver| driver.config == network_data }.first
11
+ found_driver ? found_driver : create_network_driver(network_data)
12
+ end
13
+
14
+ def create_network_driver(network_data)
15
+ driver = ::Bcome::Driver::Base.create_from_config(network_data)
16
+ @drivers << driver
17
+ driver
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,44 @@
1
+ module Bcome::Driver
2
+ class Ec2 < Bcome::Driver::Base
3
+ def initialize(*params)
4
+ super
5
+ raise Bcome::Exception::Ec2DriverMissingProvisioningRegion, params.inspect unless provisioning_region
6
+ end
7
+
8
+ def fog_client
9
+ @fog_client ||= get_fog_client
10
+ end
11
+
12
+ def fetch_server_list(filters)
13
+ servers = unfiltered_server_list.all(filters)
14
+ servers
15
+ end
16
+
17
+ def unfiltered_server_list
18
+ @unfiltered_server_list ||= fog_client.servers.all({})
19
+ end
20
+
21
+ def loading
22
+ fog_client.servers.all({})
23
+ end
24
+
25
+ def credentials_key
26
+ @params[:credentials_key]
27
+ end
28
+
29
+ def provisioning_region
30
+ @params[:provisioning_region]
31
+ end
32
+
33
+ protected
34
+
35
+ def get_fog_client
36
+ ::Fog.credential = credentials_key
37
+ client = ::Fog::Compute.new(
38
+ provider: 'AWS',
39
+ region: provisioning_region
40
+ )
41
+ client
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,4 @@
1
+ module Bcome::Driver
2
+ class Static < Bcome::Driver::Base
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class ArgumentErrorInvokingMethodFromCommmandLine < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Argument error invoking method. Please refer to documentation for invoking this command from the command line: '
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,15 @@
1
+ module Bcome::Exception
2
+ class Base < RuntimeError
3
+ def initialize(message_suffix = nil)
4
+ @message_suffix = message_suffix
5
+ end
6
+
7
+ def message
8
+ "#{message_prefix}#{@message_suffix ? ": #{@message_suffix}" : ''}"
9
+ end
10
+
11
+ def pretty_display
12
+ puts "\n#{message}\n".error
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class CanOnlySubselectOnInventory < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Invalid subselect - can only subselect on another inventory'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class CannotFindInternalRegistryKlass < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Could not initialize orchestration method '
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class CannotFindSubselectionParent < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Cannot find subselection parent'
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class CantFindKeyInCloudTags < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Cannot find key in cloud tags '
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class CantFindKeyInMetadata < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Cannot find key in bcome metadata '
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module ::Bcome::Exception
2
+ class CantFindProxyHostByIdentifier < ::Bcome::Exception::Base
3
+ def message_prefix
4
+ 'Can\'t find proxy host by identifier'
5
+ end
6
+ end
7
+ end