minfra-cli 4.1.1 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/minfra/cli/cli_starter.rb +19 -24
- data/lib/minfra/cli/hiera_looker.rb +2 -2
- data/lib/minfra/cli/patches.rb +9 -0
- data/lib/minfra/cli/templater.rb +2 -2
- data/lib/minfra/cli/version.rb +1 -1
- data/lib/minfra/cli.rb +2 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d03bf07a73181fc3684097f17a648f741a090faeb2c978d3811595419c16e6e
|
4
|
+
data.tar.gz: 2a34f444e718d6dea3b8cc667d015a0d7dcbdcea3a642dccef010d249c8c7295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '086bbbf454c3718828da81615cc774944b1e48bb029c51fde17ed222927f80f22d384367968da7c8256eb4b56d175bfca473dd8d8b1a56a69bf0d1a91e18aa11'
|
7
|
+
data.tar.gz: 5d34129f956690ef81f21740903e1ffa1bde883358e5deb01342103971293c942b6e18883d8aee14060bfe0ea1baea0399fd19d5edb57fd32f24251cd63bcb2a
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 4.2.0
|
2
|
+
* --no-rc don't load rc files
|
3
|
+
* MINFRA_DEBUG_HIERA_LOOKUPS=true also shows the results of the lookup
|
4
|
+
* adding some needed hiera patches
|
1
5
|
# 4.1.1
|
2
6
|
* fix: puts statement removed
|
3
7
|
# 4.1.0
|
@@ -26,7 +30,7 @@
|
|
26
30
|
* fixing: setup dev
|
27
31
|
* adding: colored errors and warnings
|
28
32
|
* change: wrapping hiera lookup errors of gpg
|
29
|
-
* adding:
|
33
|
+
* adding: MINFRA_DEBUG_HIERA_LOOKUPS=true
|
30
34
|
# 2.0.1
|
31
35
|
Refactorings
|
32
36
|
* installing into Kernel only when 'exec' not at 'init' time
|
@@ -27,9 +27,9 @@ module Minfra
|
|
27
27
|
|
28
28
|
init_logger
|
29
29
|
|
30
|
-
@logger.debug("Minfra: loglevel: #{@logger.level}, env: #{@config.orch_env}")
|
30
|
+
@logger.debug("Minfra: loglevel: #{@logger.level}, env: #{@config.orch_env}, options: #{@options.inspect}")
|
31
31
|
|
32
|
-
init_minfrarc
|
32
|
+
init_minfrarc unless @options[:norc]
|
33
33
|
init_envs
|
34
34
|
|
35
35
|
init_hiera
|
@@ -86,28 +86,23 @@ module Minfra
|
|
86
86
|
|
87
87
|
# will parse -e, --argv_file, --
|
88
88
|
def parse_global_options
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
95
|
-
|
96
|
-
if (idx = argv.index('--minfra_argv_file'))
|
97
|
-
@options[:argv_file] = @argv[idx + 1]
|
98
|
-
@argv.delete_at(idx)
|
99
|
-
@argv.delete_at(idx)
|
100
|
-
end
|
89
|
+
extract_option('-e', :env, 1)
|
90
|
+
extract_option('--minfra_argv_file', :argv_file, 1)
|
91
|
+
extract_option('--minfra_path', :base_path, 1)
|
92
|
+
extract_option('--no-rc', :norc)
|
93
|
+
end
|
101
94
|
|
102
|
-
|
103
|
-
|
104
|
-
|
95
|
+
def extract_option(name, sym, arity=0)
|
96
|
+
if idx = @argv.index(name)
|
97
|
+
if arity == 0
|
98
|
+
@options[sym] = true
|
99
|
+
else
|
100
|
+
@options[sym] = @argv[idx + 1]
|
101
|
+
@argv.delete_at(idx)
|
102
|
+
end
|
105
103
|
@argv.delete_at(idx)
|
106
104
|
end
|
107
|
-
|
108
|
-
@options
|
109
105
|
end
|
110
|
-
|
111
106
|
def init_minfrarc
|
112
107
|
# load minfrarc for configs
|
113
108
|
project_minfrarc_path = @config.base_path.join('config', 'minfrarc.rb')
|
@@ -149,12 +144,12 @@ module Minfra
|
|
149
144
|
env_path = config.project.dig(:minfra, :hiera, :env_path) || 'environments'
|
150
145
|
root = base_path.join('hiera')
|
151
146
|
root.join('hieradata',env_path).glob('*.eyaml').sort.each do |path|
|
152
|
-
|
153
|
-
@envs[
|
147
|
+
local_env_name = path.basename.sub(/(\..+)/,'').to_s
|
148
|
+
@envs[local_env_name]=Env.new(
|
154
149
|
hiera_root: root,
|
155
150
|
hiera_env_path: env_path,
|
156
|
-
name:
|
157
|
-
hiera_debug_lookups: ENV['MINFRA_DEBUG_HIERA_LOOKUPS'] == 'true',
|
151
|
+
name: local_env_name,
|
152
|
+
hiera_debug_lookups: ENV['MINFRA_DEBUG_HIERA_LOOKUPS'] == 'true' && env_name == local_env_name,
|
158
153
|
backends: ENV.fetch('MINFRA_HIERA_BACKENDS','').split(',')
|
159
154
|
)
|
160
155
|
end
|
@@ -31,11 +31,10 @@ module Minfra
|
|
31
31
|
node_scope = @hiera.lookup('env', {}, scope, nil, :deeper)
|
32
32
|
@scope = scope.merge(node_scope)
|
33
33
|
@debug_lookups = debug_lookups
|
34
|
+
debug("hiera: scope -> #{@scope}") if @debug_lookups
|
34
35
|
end
|
35
36
|
|
36
37
|
def l(value, default = nil)
|
37
|
-
debug "hiera: #{value}" if @debug_lookups
|
38
|
-
# debugger if @env_name == 'production-management' && value == 'env.tags'
|
39
38
|
return @cache[value] if @cache.key?(value)
|
40
39
|
|
41
40
|
values = value.split('.')
|
@@ -67,6 +66,7 @@ module Minfra
|
|
67
66
|
result = default if result.nil?
|
68
67
|
result = Hashie::Mash.new(result) if result.is_a?(Hash)
|
69
68
|
@cache[value] = result
|
69
|
+
debug "hiera: #{value} -> #{result.inspect}" if @debug_lookups
|
70
70
|
result
|
71
71
|
end
|
72
72
|
|
data/lib/minfra/cli/templater.rb
CHANGED
@@ -24,7 +24,7 @@ module Minfra
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.read(path, params: {}, fallback: nil)
|
27
|
+
def self.read(path, params: {}, helpers: [], fallback: nil)
|
28
28
|
p = Pathname.new(path)
|
29
29
|
if p.exist?
|
30
30
|
content = File.read(path)
|
@@ -34,7 +34,7 @@ module Minfra
|
|
34
34
|
content = fallback
|
35
35
|
|
36
36
|
end
|
37
|
-
render(content, params)
|
37
|
+
render(content, params, helpers: )
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.render(template, params, helpers: [])
|
data/lib/minfra/cli/version.rb
CHANGED
data/lib/minfra/cli.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minfra-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Schrammel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -210,6 +210,7 @@ files:
|
|
210
210
|
- lib/minfra/cli/kubectl_runner.rb
|
211
211
|
- lib/minfra/cli/logging.rb
|
212
212
|
- lib/minfra/cli/main_command.rb
|
213
|
+
- lib/minfra/cli/patches.rb
|
213
214
|
- lib/minfra/cli/plugin.rb
|
214
215
|
- lib/minfra/cli/plugins.rb
|
215
216
|
- lib/minfra/cli/runner.rb
|