Class: Bcome::Node::Kube::Base
- Inherits:
-
Object
- Object
- Bcome::Node::Kube::Base
show all
- Defined in:
- lib/objects/node/kube/base.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(kube_wrap, config = {}) ⇒ Base
Returns a new instance of Base.
9
10
11
12
13
|
# File 'lib/objects/node/kube/base.rb', line 9
def initialize(kube_wrap, config = {})
@kube_wrap = kube_wrap
@config = config
@resources = []
end
|
Instance Attribute Details
#resources ⇒ Object
Returns the value of attribute resources.
7
8
9
|
# File 'lib/objects/node/kube/base.rb', line 7
def resources
@resources
end
|
Instance Method Details
#build ⇒ Object
23
24
25
26
|
# File 'lib/objects/node/kube/base.rb', line 23
def build
child_node_lookup_result = run(get_child_node_command)
parse(child_node_lookup_result)
end
|
#get_child_config_from_line(*_params) ⇒ Object
46
47
48
|
# File 'lib/objects/node/kube/base.rb', line 46
def get_child_config_from_line(*_params)
raise 'should be overidden'
end
|
#get_child_node_command ⇒ Object
42
43
44
|
# File 'lib/objects/node/kube/base.rb', line 42
def get_child_node_command
raise 'should be overriden'
end
|
#parent ⇒ Object
15
16
17
|
# File 'lib/objects/node/kube/base.rb', line 15
def parent
@config[:parent]
end
|
#parse(child_node_lookup_result) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/objects/node/kube/base.rb', line 28
def parse(child_node_lookup_result)
output = child_node_lookup_result.stdout
data = output.remove_lines(1).split("\n")
structured_data = {}
data.each do |raw_namespace_line|
child_config = get_child_config_from_line(raw_namespace_line)
child_config.merge!(parent: self)
@resources << child_node_klass.new(@kube_wrap, child_config)
end
end
|
#run(command) ⇒ Object
19
20
21
|
# File 'lib/objects/node/kube/base.rb', line 19
def run(command)
@kube_wrap.run(command)
end
|