mixlib-config 3.0.1 → 3.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mixlib/config.rb +14 -9
- data/lib/mixlib/config/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 542f1c9f7daff1297b70799397e6f44dba7896522e89334e71496db690802013
|
4
|
+
data.tar.gz: f2383ad0c71049dab95ceeac81d39d7b8ed1d8cb2e9a6ed45ac29acaa0d63838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4137a9a0747261ad42cc1f3035ab6136823ee3c89666e7adf041e36190cd24179e0eee5711686011ab7c1e7efead2242aef88c6f9c0e03bfee8ef41509492be
|
7
|
+
data.tar.gz: 22248d0a227c55598fa81debb29a0eaa9436d27192bfbd45beb091b0ace555b4abd4783f09ef7c1febca965b386320268dada9fe5f45a94485cc266695144a9b
|
data/lib/mixlib/config.rb
CHANGED
@@ -33,11 +33,11 @@ module Mixlib
|
|
33
33
|
class << base; attr_accessor :config_context_lists; end
|
34
34
|
class << base; attr_accessor :config_context_hashes; end
|
35
35
|
class << base; attr_accessor :config_parent; end
|
36
|
-
base.configuration =
|
37
|
-
base.configurables =
|
38
|
-
base.config_contexts =
|
39
|
-
base.config_context_lists =
|
40
|
-
base.config_context_hashes =
|
36
|
+
base.configuration = ({})
|
37
|
+
base.configurables = ({})
|
38
|
+
base.config_contexts = ({})
|
39
|
+
base.config_context_lists = ({})
|
40
|
+
base.config_context_hashes = ({})
|
41
41
|
base.initialize_mixlib_config
|
42
42
|
end
|
43
43
|
|
@@ -165,8 +165,8 @@ module Mixlib
|
|
165
165
|
|
166
166
|
# Resets all config options to their defaults.
|
167
167
|
def reset
|
168
|
-
self.configuration =
|
169
|
-
config_contexts.values.each
|
168
|
+
self.configuration = ({})
|
169
|
+
config_contexts.values.each(&:reset)
|
170
170
|
end
|
171
171
|
|
172
172
|
# Makes a copy of any non-default values.
|
@@ -372,6 +372,7 @@ module Mixlib
|
|
372
372
|
if config_contexts.key?(symbol)
|
373
373
|
raise ReopenedConfigContextWithConfigurableError, "Cannot redefine config_context #{symbol} as a configurable value"
|
374
374
|
end
|
375
|
+
|
375
376
|
configurables[symbol] = Configurable.new(symbol)
|
376
377
|
define_attr_accessor_methods(symbol)
|
377
378
|
end
|
@@ -531,9 +532,10 @@ module Mixlib
|
|
531
532
|
# <ArgumentError>:: if value is set to something other than true, false, or :warn
|
532
533
|
#
|
533
534
|
def config_strict_mode=(value)
|
534
|
-
|
535
|
+
unless [ true, false, :warn, nil ].include?(value)
|
535
536
|
raise ArgumentError, "config_strict_mode must be true, false, nil or :warn"
|
536
537
|
end
|
538
|
+
|
537
539
|
@config_strict_mode = value
|
538
540
|
end
|
539
541
|
|
@@ -567,7 +569,10 @@ module Mixlib
|
|
567
569
|
def apply_nested_hash(hash)
|
568
570
|
hash.each do |k, v|
|
569
571
|
if v.is_a? Hash
|
570
|
-
|
572
|
+
# If loading from hash, and we reference a context that doesn't exist
|
573
|
+
# and warning/strict is off, we need to create the config context that we expected to be here.
|
574
|
+
context = internal_get(k.to_sym) || config_context(k.to_sym)
|
575
|
+
context.apply_nested_hash(v)
|
571
576
|
else
|
572
577
|
internal_set(k.to_sym, v)
|
573
578
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tomlrb
|