Module: Platform
- Defined in:
- lib/cem_acpt/platform/gcp.rb,
lib/cem_acpt/platform/vmpooler.rb
Overview
Currently a placeholder for future functionality
Defined Under Namespace
Modules: SpecMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
Extends the class with class methods from the SpecMethods module.
Instance Method Summary collapse
-
#destroy ⇒ Object
Destroy a GCP instance.
-
#install_puppet_module_package ⇒ Object
Uploads and installs a Puppet module package on the GCP instance.
-
#node ⇒ Object
Returns information about the GCP instance.
-
#provision ⇒ Object
Provision a GCP instance.
-
#ready? ⇒ Boolean
Returns true if the GCP instance is ready for use in the test suite.
-
#run_tests(&block) ⇒ Object
Runs the test suite against the GCP instance.
Class Method Details
.included(base) ⇒ Object
Extends the class with class methods from the SpecMethods module
55 56 57 |
# File 'lib/cem_acpt/platform/gcp.rb', line 55 def self.included(base) base.extend(SpecMethods) end |
Instance Method Details
#destroy ⇒ Object
Destroy a GCP instance
28 29 30 |
# File 'lib/cem_acpt/platform/gcp.rb', line 28 def destroy @instance.destroy end |
#install_puppet_module_package ⇒ Object
Uploads and installs a Puppet module package on the GCP instance.
46 47 48 49 50 51 52 |
# File 'lib/cem_acpt/platform/gcp.rb', line 46 def install_puppet_module_package(module_pkg_path, remote_path = nil, puppet_path = '/opt/puppetlabs/bin/puppet') remote_path = remote_path.nil? ? File.join('/tmp', File.basename(module_pkg_path)) : remote_path logger.info("Uploading module package #{module_pkg_path} to #{remote_path} on #{node_name} and installing it...") logger.debug("Using puppet path: #{puppet_path}") @instance.install_puppet_module_package(module_pkg_path, remote_path, puppet_path) logger.info("Module package #{module_pkg_path} installed on #{node_name}") end |
#node ⇒ Object
Returns information about the GCP instance
9 10 11 |
# File 'lib/cem_acpt/platform/gcp.rb', line 9 def node @instance.info end |
#provision ⇒ Object
Provision a GCP instance
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cem_acpt/platform/gcp.rb', line 14 def provision creation_params = config.dup creation_params[:disk][:image_name] = image_name creation_params[:local_port] = local_port @instance = CemAcpt::Platform::Gcp::VM.new( node_name, components: creation_params, ) @instance.configure! logger.debug("Creating with command: #{@instance.send(:create_cmd)}") @instance.create end |
#ready? ⇒ Boolean
Returns true if the GCP instance is ready for use in the test suite
33 34 35 36 |
# File 'lib/cem_acpt/platform/gcp.rb', line 33 def ready? logger.debug("Checking if #{node_name} is ready...") @instance.ready? end |
#run_tests(&block) ⇒ Object
Runs the test suite against the GCP instance. Must be given a block. If necessary, can pass information into the block to be used in the test suite.
40 41 42 43 |
# File 'lib/cem_acpt/platform/gcp.rb', line 40 def run_tests(&block) logger.debug("Running tests for #{node_name}...") block.call @instance.cmd.env end |