Class: LASRpcUtils::Transport

Inherits:
Object
  • Object
show all
Includes:
MintLogger
Defined in:
src/las-rpc-utils/lib/las-rpc-utils/transport.rb

Properties (Read/Write)

Properties (Read Only)

Constant Summary

Constants included from MintLogger

MintLogger::DEBUG, MintLogger::ERROR, MintLogger::FATAL, MintLogger::INFO, MintLogger::UNKNOWN, MintLogger::VERBOSE, MintLogger::WARN

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MintLogger::Utils::Common

#boolean_val, #has_value?, #no_value?, #nvl, #path_as_symbol, #ruby_level_to_send

Constructor Details

#initialize(host, type = nil, transport_options = {}, hop_list = []) ⇒ Transport

Returns a new instance of Transport.

Instance Attribute Details

#hostObject

Returns the value of attribute host.

#initObject (readonly)

Returns the value of attribute init.

#initializingObject

Returns the value of attribute initializing.

#pathObject

Returns the value of attribute path.

#temp_folderObject (readonly)

Returns the value of attribute temp_folder.

#transport_optionsObject (readonly)

Returns the value of attribute transport_options.

#typeObject

Returns the value of attribute type.

#work_ruby_sessionObject

Get set of transports to a host. The actual connections themslves are abstracted as the `channel` concept This needs to support at least: type - local, ssh, winrm host/port - the final destination auth - password/key/secrets/etc bastian - bastion host for accessing. This can be an array if you require multiple hops

Instance Method Details

#_run_command(command, environment: nil) ⇒ Object

#add_default_env(env_hash) ⇒ Object

#add_default_path(path) ⇒ Object

#add_hop!(host, type, transport_options) ⇒ Object

#alive?Boolean

Returns:

  • (Boolean)

#anychannelObject

#block_until_closedObject

ensure that the SSH transport is closed - this should be a rare call... mostly if required for some kind of compliance reason?

#channel(channel_id: nil, &block) ⇒ Object

#check_ruby(always_reset: false, parent_channel: nil) ⇒ Object

This probably does NOT need the all channels mutex, but I'm honsetly not 100% sure, so i'm not going to remove it just yet - since i believe it does, at least, need to share a lock with get_ruby...

#connectable?(host, port, timeout: 2) ⇒ Boolean

Returns:

  • (Boolean)

#content(remote) ⇒ Object

#content_via_shell(remote) ⇒ Object

#debug?Boolean

Returns:

  • (Boolean)

#directfile(remote) ⇒ Object

#erb_file(source, filename, vars: {}) ⇒ Object

#execute(command, environment: {}, loglevel: 'info', fast: false, use_transport: nil, mask_command: false, timeout: nil) ⇒ Object

Do we need to do things for sudo here? Maybe!

#exist?(filename) ⇒ Boolean

Returns:

  • (Boolean)

#file_exists?(filename) ⇒ Boolean

Returns:

  • (Boolean)

#generic_sync(source_File, dest_File, source_Dir, dest_Dir, dest_FileUtils, source_hash, dest_hash, source, dest, source_transport, dest_transport, delete_synced: false) ⇒ Object

#get_ruby(force: false) ⇒ Object

This needs a mutex to stop it spawning lots of rubies if we already have one... specifically, it needs the _all channels mutex_ to avoid attempting to put multiple rubies on the box

#getfile(remote, local) ⇒ Object

#http_get(url, file) ⇒ Object

#is_directory?(filename) ⇒ Boolean

Returns:

  • (Boolean)

#is_file?(filename) ⇒ Boolean

Returns:

  • (Boolean)

#is_readable?(filename) ⇒ Boolean

Returns:

  • (Boolean)

#is_writable?(filename) ⇒ Boolean

Returns:

  • (Boolean)

#local_hash(filename_list) ⇒ Object

#local_stat(filename_list) ⇒ Object

#port_forward_via_local(local_address, local_port, remote_address, remote_port) ⇒ Object

#putcontent(content, remote) ⇒ Object

#putcontent_shell(content, remote) ⇒ Object

FIXME: potentially chunk this!

#putcontent_shell_raw(content, remote) ⇒ Object

#putdirect(remote, content) ⇒ Object

#putfile(local, remote) ⇒ Object

Convinience functions!

#putfile_shell(local, remote) ⇒ Object

#release_transportObject

Release our transport. Note this is not guarenteed to close the SSH connection After calling this, the object becomes invalid

#remote_hash(filename_list) ⇒ Object

#remote_stat(filename_list) ⇒ Object

#reset_default_envObject

#restore_log_prefixObject

#rmdirect(remote) ⇒ Object

these are non-sudo and hence for internal use only in particular, you MUST check if it's a direct connection, or else things will fail!!

#ruby(ruby_command_timeout: 3600, &block) ⇒ Object

execute ruby on the remote end by shipping an interpreter and running code directly Uses eval() with the current scope passed over?

#ruby_include(thing) ⇒ Object

#ruby_require(thing) ⇒ Object

FIXME: make these local, not global!

#set_default_env(env_hash) ⇒ Object

#set_default_init(init) ⇒ Object

#set_default_path(path) ⇒ Object

#set_initializing(channel) ⇒ Object

#set_temp_folder(path) ⇒ Object

#set_transport_log_prefixObject

#start_execute(command, environment: {}, loglevel: 'info', fast: false, use_transport: nil, channel_id: nil) ⇒ Object

#sync_from(source, local_dest, delete_local: false) ⇒ Object

#sync_to(source, remote_dest, delete_local: false) ⇒ Object

#sync_to_remote(source, remote_transport, remote_dest) ⇒ Object

#test_file?(filename:, test_type:) ⇒ Boolean

Returns:

  • (Boolean)

#wrap_object(o) ⇒ Object

#xfer_from_remote(remote_source, remote_transport, local_dest) ⇒ Object

#xfer_raw(source_File, dest_File, source, dest) ⇒ Object

#xfer_raw_unthreaded(source_File, dest_File, source, dest) ⇒ Object

#xfer_to_remote(source, remote_transport, remote_dest) ⇒ Object