Class: OsCtl::ExportFS::Operations::Server::Attach
- Includes:
- Lib::Utils::Log, Lib::Utils::System
- Defined in:
- lib/osctl/exportfs/operations/server/attach.rb
Overview
Attach to the server’s namespaces and run shell
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
protected
Returns the value of attribute server.
Instance Method Summary collapse
- #bash_interactive ⇒ Object protected
- #execute ⇒ Object
-
#initialize(name) ⇒ Attach
constructor
A new instance of Attach.
Methods inherited from Base
Constructor Details
Instance Attribute Details
#server ⇒ Object (readonly, protected)
Returns the value of attribute server.
27 28 29 |
# File 'lib/osctl/exportfs/operations/server/attach.rb', line 27 def server @server end |
Instance Method Details
#bash_interactive ⇒ Object (protected)
29 30 31 |
# File 'lib/osctl/exportfs/operations/server/attach.rb', line 29 def bash_interactive syscmd("nix-build --no-out-link '<nixpkgs>' -A bashInteractive").output.strip end |
#execute ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/osctl/exportfs/operations/server/attach.rb', line 15 def execute bin_bash = File.join(bash_interactive, 'bin/bash') Operations::Server::Exec.run(server) do ENV['PATH'] = "#{ENV.fetch('PATH', nil)}:/run/current-system/sw/bin" ENV['PS1'] = "[NFSD #{server.name}]# " Process.exec(bin_bash, '--norc') end end |