From 07f2b18a8a3de0e1af38a1db7358a1a2f0869377 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 26 Apr 2020 10:52:59 +0200 Subject: salt: T2382: migrate get_config() to list items --- src/conf_mode/salt-minion.py | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/conf_mode/salt-minion.py b/src/conf_mode/salt-minion.py index 55139dca1..c0c7c3080 100755 --- a/src/conf_mode/salt-minion.py +++ b/src/conf_mode/salt-minion.py @@ -43,36 +43,36 @@ default_config_data = { def get_config(): salt = deepcopy(default_config_data) conf = Config() - if not conf.exists('service salt-minion'): + base = ['service', 'salt-minion'] + + if not conf.exists(base): return None else: - conf.set_level('service salt-minion') + conf.set_level(base) - if conf.exists('hash_type'): - salt['hash_type'] = conf.return_value('hash_type') + if conf.exists(['hash_type']): + salt['hash_type'] = conf.return_value(['hash_type']) - if conf.exists('log_file'): - salt['log_file'] = conf.return_value('log_file') + if conf.exists(['log_file']): + salt['log_file'] = conf.return_value(['log_file']) - if conf.exists('log_level'): - salt['log_level'] = conf.return_value('log_level') + if conf.exists(['log_level']): + salt['log_level'] = conf.return_value(['log_level']) - if conf.exists('master'): - master = conf.return_values('master') - salt['master'] = master + if conf.exists(['master']): + salt['master'] = conf.return_values(['master']) - if conf.exists('id'): - salt['salt_id'] = conf.return_value('id') + if conf.exists(['id']): + salt['salt_id'] = conf.return_value(['id']) - if conf.exists('user'): - salt['user'] = conf.return_value('user') + if conf.exists(['user']): + salt['user'] = conf.return_value(['user']) - if conf.exists('mine_interval'): - salt['mine_interval'] = conf.return_value('mine_interval') + if conf.exists(['mine_interval']): + salt['mine_interval'] = conf.return_value(['mine_interval']) - salt['master-key'] = None - if conf.exists('master-key'): - salt['master-key'] = conf.return_value('master-key') + if conf.exists(['master-key']): + salt['master_key'] = conf.return_value(['master-key']) salt['verify_master_pubkey_sign'] = 'true' return salt -- cgit v1.2.3