Class: TrainPlugins::TrainKubernetes::KubectlClient
- Inherits:
-
Object
- Object
- TrainPlugins::TrainKubernetes::KubectlClient
- Defined in:
- lib/train-kubernetes/kubectl_client.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#pod ⇒ Object
readonly
Returns the value of attribute pod.
Instance Method Summary collapse
- #execute(command, stdin: true, tty: true) ⇒ Object
-
#initialize(pod:, container: nil) ⇒ KubectlClient
constructor
A new instance of KubectlClient.
Constructor Details
#initialize(pod:, container: nil) ⇒ KubectlClient
Returns a new instance of KubectlClient.
7 8 9 10 |
# File 'lib/train-kubernetes/kubectl_client.rb', line 7 def initialize(pod:, container: nil) @pod = pod @container = container end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
6 7 8 |
# File 'lib/train-kubernetes/kubectl_client.rb', line 6 def container @container end |
#pod ⇒ Object (readonly)
Returns the value of attribute pod.
6 7 8 |
# File 'lib/train-kubernetes/kubectl_client.rb', line 6 def pod @pod end |
Instance Method Details
#execute(command, stdin: true, tty: true) ⇒ Object
12 13 14 15 16 |
# File 'lib/train-kubernetes/kubectl_client.rb', line 12 def execute(command, stdin: true, tty: true) instruction = build_instruction(command, stdin, tty) shell = Mixlib::ShellOut.new(instruction) shell.run_command end |