getting KeyError: 'providers' error when we run salt-cloud --list-providers command
search cancel

getting KeyError: 'providers' error when we run salt-cloud --list-providers command

book

Article ID: 419013

calendar_today

Updated On:

Products

VCF Operations/Automation (formerly VMware Aria Suite)

Issue/Introduction

There is an error thrown when running the salt-cloud --list-providers command on the Salt master. 

salt-cloud --list-providers
Usage: salt-cloud [options] <-m MAP | -p PROFILE> <NAME> [NAME2 ...]

[ERROR   ] 'providers'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/parsers.py", line 197, in parse_args
    process_option_func()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/parsers.py", line 571, in process_config_dir
    self.config.update(self.setup_config())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/parsers.py", line 3468, in setup_config
    return config.cloud_config(self.get_config_file_path())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 2767, in cloud_config
    providers_config = cloud_providers_config(providers_config_path)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 3050, in cloud_providers_config
    return apply_cloud_providers_config(overrides, defaults)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 3074, in apply_cloud_providers_config
    for prov_name, prov_settings in config.pop("providers").items():
KeyError: 'providers'
salt-cloud: error: Error while processing <bound method ConfigDirMixIn.process_config_dir of <salt.cloud.cli.SaltCloud object at 0x7fa2ecb6b8b0>>: Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/parsers.py", line 197, in parse_args
    process_option_func()
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/parsers.py", line 571, in process_config_dir
    self.config.update(self.setup_config())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/parsers.py", line 3468, in setup_config
    return config.cloud_config(self.get_config_file_path())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 2767, in cloud_config
    providers_config = cloud_providers_config(providers_config_path)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 3050, in cloud_providers_config
    return apply_cloud_providers_config(overrides, defaults)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/config/__init__.py", line 3074, in apply_cloud_providers_config
    for prov_name, prov_settings in config.pop("providers").items():
KeyError: 'providers'

timed out waiting for input: auto-logout KeyError: 'providers'

Environment

salt-cloud 3006.12+

Cause

The cause is likely due to an unclean or a mixed installation of Salt. This may occur if the environment has been upgraded several times from older versions of Salt. This may happen when attempting to use providers other than the default Saltify driver. 

Resolution

If your Salt master is integrated with Aria Config, then use of salt-cloud should be limited to debugging deployments from Aria Automation. 

  • Uninstall Salt completely
    • yum/tdnf/dnf remove salt\*
    • The exact command to use may depend on the OS. Please refer to your OS provider's documentation for how to manage packages.
  • Find and remove any salt installation directory
    • find / -type d -iname "salt"
    • The above command will generate a list and may find additional directories that are not to be removed. 
  • Re-install Salt

NOTE: The following instructions only apply if you are attempting to extend some Salt functionality and is not necessary for users that are integrated with Aria Config. 

  • Install pyvmomi version 7.0.3 with salt-pip install pyvmomi==7.0.3
    • We need to use the salt-pip command to ensure that pyvmomi is installed to the correct Python environment.
    • Salt provides its own Python executables which are completely separate from your system Python.
    • Installing this package from your OS package manager will not work to install this package correctly.
  • Configure the cloud provider (YAML doesn't like dotted names lke FQDN, so put in single quotes or don't use FQDN as the ID)