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.
25 26 27 |
# File 'lib/osctl/exportfs/operations/server/attach.rb', line 25 def server @server end |
Instance Method Details
#bash_interactive ⇒ Object (protected)
27 28 29 |
# File 'lib/osctl/exportfs/operations/server/attach.rb', line 27 def bash_interactive syscmd("nix-build --no-out-link '<nixpkgs>' -A bashInteractive").output.strip end |
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/osctl/exportfs/operations/server/attach.rb', line 14 def execute bin_bash = File.join(bash_interactive, 'bin/bash') Operations::Server::Exec.run(server) do ENV['PATH'] = "#{ENV['PATH']}:/run/current-system/sw/bin" ENV['PS1'] = "[NFSD #{server.name}]# " Process.exec(bin_bash, '--norc') end end |