diff options
author | Marc A. Paradise <marc.paradise@gmail.com> | 2019-06-07 15:39:36 -0400 |
---|---|---|
committer | Marc A. Paradise <marc.paradise@gmail.com> | 2019-06-07 15:39:36 -0400 |
commit | 023c89e326251e8c2f063aa6f4ecd787cd35316f (patch) | |
tree | 22ad7a01ace4af3146b44223debeeeaa08467950 /lib/mixlib/cli.rb | |
parent | 47eb2730d081be1ef02b81e25a19187a4cd5703d (diff) | |
download | mixlib-cli-deprecation-fix-unknown-keys.tar.gz |
Don't explode when there are unknown keys in 'config'deprecation-fix-unknown-keys
Update handle_deprecated_options to be graceful when
'config' has been modified externally to contain unknown keys.
Signed-off-by: Marc A. Paradise <marc.paradise@gmail.com>
Diffstat (limited to 'lib/mixlib/cli.rb')
-rw-r--r-- | lib/mixlib/cli.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/mixlib/cli.rb b/lib/mixlib/cli.rb index 1a83a11..d0c1c67 100644 --- a/lib/mixlib/cli.rb +++ b/lib/mixlib/cli.rb @@ -392,11 +392,16 @@ module Mixlib merge_in_values = {} config.each_key do |opt_key| opt_cfg = options[opt_key] + # Deprecated entries do not have defaults so no matter what # separate_default_options are set, if we see a 'config' # entry that contains a deprecated indicator, then the option was # explicitly provided by the caller. - next unless opt_cfg[:deprecated] + # + # opt_cfg may not exist if an inheriting application + # has directly inserted values info config. + next unless opt_cfg && opt_cfg[:deprecated] + replacement_key = opt_cfg[:replacement] if replacement_key # This is the value passed into the deprecated flag. We'll use |