minfra-cli 1.2.2 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7cc9eb903029df09bcf00c7658d8262f59803e91a1401d4f7193498ec2be4a83
4
- data.tar.gz: f75a3b6f82edba2afb7ffeacb9faf4ec4aadaf4d9f6a3c76465e481d33a84b5c
3
+ metadata.gz: c6145d8b76367e739eb7b93bcfdcaf22428004ab45de977215e874c8b59da64b
4
+ data.tar.gz: 8811fbed0e951e862888428e4370cc10d9c4fa199e9d9fa567b847ec1f689383
5
5
  SHA512:
6
- metadata.gz: fb2439b3b555c6aebb7e12ad6e50b33e4c8fe2253ce367e7c77a5ca6a6094c4e54a6576668d8461236d7208eea93090e85423bd323a5e96686e406b6c1dec334
7
- data.tar.gz: b701d0bff17d6639d09cb5dc307856bc07191c9d2d11f8bbef7b90c5fcb49ca86e841c1f50c0740dbbbe24e949d6a73ed63522a6a5f678a79510bb5873e75b0a
6
+ metadata.gz: 61359dada17608504dac46c3af40fc94e8a7d53f468ca95f6bcec518c9d7c9b32a7a6ff14540286c1fcc9b14d6eee45df4df336e6156a0a8cea8c986c8188fd5
7
+ data.tar.gz: 9792bf505ded5f51f4955be00f13fae965aaaadf17caa1606f310ebbb600cc145929ab5e39b31c4c0dc707a1de24912dd830f2c6749077db8d42961539a594ce
data/CHANGELOG.md CHANGED
@@ -1,4 +1,6 @@
1
- # 1.2.
1
+ # 1.3.0
2
+ * deep lookup value like "env.cluster.name"
3
+ # 1.2.2
2
4
  * fixing tagging
3
5
  # 1.2.1
4
6
  * fixing merge
@@ -1,5 +1,5 @@
1
1
  module Minfra
2
2
  module Cli
3
- VERSION = '1.2.2'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
5
5
  end
data/lib/minfra/cli.rb CHANGED
@@ -68,7 +68,6 @@ module Minfra
68
68
  env= @config.orch_env
69
69
  raise("unknown environment #{env}, I expact a file at hiera/hieradata/environments/#{env}.eyaml") unless @hiera_root.join("hieradata/environments/#{env}.eyaml").exist?
70
70
 
71
-
72
71
  scope={ "hieraroot" => @hiera_root.to_s, "env" => env}
73
72
  special_lookups=hiera.lookup("lookup_options", {}, scope, nil, :priority)
74
73
 
@@ -76,15 +75,23 @@ module Minfra
76
75
  scope=scope.merge(node_scope)
77
76
  cache={}
78
77
  Kernel.define_method(:l) do |value,default=nil|
78
+
79
79
  return cache[value] if cache.has_key?(value)
80
80
 
81
+ values=value.split(".")
82
+ value=values.shift
83
+
81
84
  if special_lookups[value]
82
85
  lookup_type={ merge_behavior: special_lookups[value]["merge"].to_sym }
83
86
  else
84
- lookup_type=:native #priority
87
+ lookup_type=:deep
85
88
  end
86
89
 
87
90
  result=hiera.lookup(value, default, scope, nil, lookup_type)
91
+ unless values.empty?
92
+ result=result.dig(*values)
93
+ end
94
+
88
95
  result=Hashie::Mash.new(result) if result.kind_of?(Hash)
89
96
  cache[value] = result
90
97
  result
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: 1.2.2
4
+ version: 1.3.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: 2022-10-29 00:00:00.000000000 Z
11
+ date: 2022-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  - !ruby/object:Gem::Version
234
234
  version: '0'
235
235
  requirements: []
236
- rubygems_version: 3.3.5
236
+ rubygems_version: 3.1.6
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: A cli framework for k8s based development and deployment.