Class: LASRpcUtils::Transport
- Inherits:
-
Object
- Object
- LASRpcUtils::Transport
- 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
-
#host ⇒ Object
Returns the value of attribute host.
-
#init ⇒ Object
readonly
Returns the value of attribute init.
-
#initializing ⇒ Object
Returns the value of attribute initializing.
-
#path ⇒ Object
Returns the value of attribute path.
-
#temp_folder ⇒ Object
readonly
Returns the value of attribute temp_folder.
-
#transport_options ⇒ Object
readonly
Returns the value of attribute transport_options.
-
#type ⇒ Object
Returns the value of attribute type.
-
#work_ruby_session ⇒ Object
Get set of transports to a host.
Instance Method Summary collapse
- #_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
- #anychannel ⇒ Object
-
#block_until_closed ⇒ Object
ensure that the SSH transport is closed - this should be a rare call...
- #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
- #content(remote) ⇒ Object
- #content_via_shell(remote) ⇒ Object
- #debug? ⇒ 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
- #file_exists?(filename) ⇒ 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...
- #getfile(remote, local) ⇒ Object
- #http_get(url, file) ⇒ Object
-
#initialize(host, type = nil, transport_options = {}, hop_list = []) ⇒ Transport
constructor
A new instance of Transport.
- #is_directory?(filename) ⇒ Boolean
- #is_file?(filename) ⇒ Boolean
- #is_readable?(filename) ⇒ Boolean
- #is_writable?(filename) ⇒ 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_transport ⇒ Object
Release our transport.
- #remote_hash(filename_list) ⇒ Object
- #remote_stat(filename_list) ⇒ Object
- #reset_default_env ⇒ Object
- #restore_log_prefix ⇒ Object
-
#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_prefix ⇒ Object
- #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
- #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
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
#host ⇒ Object
Returns the value of attribute host.
#init ⇒ Object (readonly)
Returns the value of attribute init.
#initializing ⇒ Object
Returns the value of attribute initializing.
#path ⇒ Object
Returns the value of attribute path.
#temp_folder ⇒ Object (readonly)
Returns the value of attribute temp_folder.
#transport_options ⇒ Object (readonly)
Returns the value of attribute transport_options.
#type ⇒ Object
Returns the value of attribute type.
#work_ruby_session ⇒ Object
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
#anychannel ⇒ Object
#block_until_closed ⇒ Object
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
#content(remote) ⇒ Object
#content_via_shell(remote) ⇒ Object
#debug? ⇒ 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
#file_exists?(filename) ⇒ 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
#is_file?(filename) ⇒ Boolean
#is_readable?(filename) ⇒ Boolean
#is_writable?(filename) ⇒ 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_transport ⇒ Object
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_env ⇒ Object
#restore_log_prefix ⇒ Object
#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!