Class: Minfra::Cli::StackM::KubeStackTemplate
- Inherits:
-
Object
- Object
- Minfra::Cli::StackM::KubeStackTemplate
show all
- Includes:
- Logging
- Defined in:
- lib/minfra/cli/commands/stack/kube_stack_template.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Logging
#debug, #deprecated, #error, #exit_error, #info, #warn
Constructor Details
#initialize(name, config, cluster:, deployment: '') ⇒ KubeStackTemplate
Returns a new instance of KubeStackTemplate.
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 12
def initialize(name, config, cluster:, deployment: '')
@name = name
@config_path = config.stacks_path.join(name)
@errors = []
@config = config
@env = config.orch_env
@deployment = deployment.freeze
@cluster = cluster.freeze || l!('cluster').id
@result_path = config.status_path.join('stacks', @cluster, name)
debug "Stack selection: #{@name}, #{@config_path}, #{@cluster}, #{@result_path}"
end
|
Instance Attribute Details
#config_path ⇒ Object
Returns the value of attribute config_path.
10
11
12
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 10
def config_path
@config_path
end
|
#deployment ⇒ Object
Returns the value of attribute deployment.
10
11
12
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 10
def deployment
@deployment
end
|
#env ⇒ Object
Returns the value of attribute env.
10
11
12
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 10
def env
@env
end
|
#name ⇒ Object
Returns the value of attribute name.
10
11
12
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 10
def name
@name
end
|
Instance Method Details
#check_plan ⇒ Object
61
62
63
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 61
def check_plan
[]
end
|
#cluster_name ⇒ Object
24
25
26
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 24
def cluster_name
@cluster
end
|
#compose_path(blank: false) ⇒ Object
43
44
45
46
47
48
49
50
51
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 43
def compose_path(blank: false)
if blank
release_path.join('compose.yaml')
elsif @cluster
release_path.join("compose#{dashed(@cluster)}.yaml")
else
release_path.join("compose#{dashed(@env)}#{dashed(@deployment)}.yaml")
end
end
|
#error_message ⇒ Object
53
54
55
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 53
def error_message
@errors.join(";\n")
end
|
#mixin_env ⇒ Object
28
29
30
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 28
def mixin_env
"#{@env}#{dashed(@deployment)}"
end
|
#release_path ⇒ Object
57
58
59
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 57
def release_path
@result_path
end
|
#stack_rb_path ⇒ Object
39
40
41
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 39
def stack_rb_path
config_path.join('stack.rb')
end
|
#valid? ⇒ Boolean
32
33
34
35
36
37
|
# File 'lib/minfra/cli/commands/stack/kube_stack_template.rb', line 32
def valid?
@errors << "stack path #{@config_path} doesn't exist" unless @config_path.exist?
@errors << "stack.rb file #{stack_rb_path} doesn't exist" unless stack_rb_path.exist?
@errors.empty?
end
|