salt icon indicating copy to clipboard operation
salt copied to clipboard

[BUG] issues with loading boto modules with salt 3006.5

Open defanator opened this issue 6 months ago • 7 comments

Description After upgrading from 3006.4 to 3006.5 we are no longer able to use states that rely on a family of boto_* modules.

Setup TBA

Please be as specific as possible and give set-up details.

  • [x] VM running on a cloud service, please be explicit and add details
  • [x] onedir packaging

Steps to Reproduce the behavior Try to apply corresponding states.

Expected behavior No errors while loading modules.

Actual behavior

[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_asg. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_asg.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_asg', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_cloudwatch. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_cloudwatch.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_cloudwatch', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_dynamodb. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_dynamodb.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_dynamodb', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_ec2. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_ec2.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_ec2', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_elasticache. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_elasticache.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_elasticache', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_elb. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_elb.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_elb', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_secgroup. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_secgroup.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_secgroup', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_sns. Module will not be loaded: '__salt__'
[WARNING ] salt.loaded.int.module.boto_sns.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_sns', please fix this.
[ERROR   ] State 'boto_vpc.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_vpc' __virtual__ returned False: The following libraries are required to run the boto_vpc state module: boto >= 2.8.0 and boto3 >= 1.2.6.

[ERROR   ] State 'boto_vpc.internet_gateway_present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_vpc' __virtual__ returned False: The following libraries are required to run the boto_vpc state module: boto >= 2.8.0 and boto3 >= 1.2.6.

[ERROR   ] State 'boto_secgroup.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_secgroup' __virtual__ returned False: boto_secgroup module could not be loaded

[ERROR   ] State 'boto_secgroup.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_secgroup' __virtual__ returned False: boto_secgroup module could not be loaded

[ERROR   ] State 'boto_secgroup.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_secgroup' __virtual__ returned False: boto_secgroup module could not be loaded

[ERROR   ] State 'boto_secgroup.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_secgroup' __virtual__ returned False: boto_secgroup module could not be loaded

[ERROR   ] State 'boto_secgroup.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_secgroup' __virtual__ returned False: boto_secgroup module could not be loaded

[ERROR   ] State 'boto_secgroup.present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_secgroup' __virtual__ returned False: boto_secgroup module could not be loaded

[ERROR   ] State 'boto_vpc.route_table_present' was not found in SLS 'datacenters.pdx1.mgmt.vpc'
Reason: 'boto_vpc' __virtual__ returned False: The following libraries are required to run the boto_vpc state module: boto >= 2.8.0 and boto3 >= 1.2.6.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
          Salt: 3006.5
 
Python Version:
        Python: 3.10.13 (main, Nov 15 2023, 04:34:27) [GCC 11.2.0]
 
Dependency Versions:
          cffi: 1.14.6
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.1.2
       libgit2: 1.3.0
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: 1.8.0
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.14.2
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4
 
System Versions:
          dist: debian 11 bullseye
        locale: utf-8
       machine: x86_64
       release: 5.10.0-25-cloud-amd64
        system: Linux
       version: Debian GNU/Linux 11 bullseye

Additional context

Installed boto versions:

# salt-pip list | fgrep boto
boto               2.49.0
boto3              1.33.13
botocore           1.33.13

[notice] A new release of pip is available: 23.1.1 -> 23.3.1
[notice] To update, run: /opt/saltstack/salt/bin/python3.10 -m pip install --upgrade pip

Debug log excerpts while trying to apply states through salt-call:

[DEBUG   ] The functions from module 'config' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded config.option
[DEBUG   ] The functions from module 'boto3' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_elb_tag' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto' are being loaded by dir() on the loaded module
[DEBUG   ] LazyLoaded boto.assign_funcs
[DEBUG   ] Error loading module.boto_vpc: __init__ failed
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 902, in _load_module
    self.run(module_init, self.opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_vpc.py", line 187, in __init__
    __utils__["boto.assign_funcs"](__name__, "vpc", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[..]
[DEBUG   ] The functions from module 'baredoc' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'beacons' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'bigip' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto3_elasticache' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto3_elasticsearch' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto3_route53' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto3_sns' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_apigateway' are being loaded by dir() on the loaded module
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_asg. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_asg.py", line 86, in __virtual__
    __utils__["boto.assign_funcs"](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_asg.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_asg', please fix this.
[DEBUG   ] Error loading module.boto_cfn: __init__ failed
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 902, in _load_module
    self.run(module_init, self.opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cfn.py", line 65, in __init__
    __utils__["boto.assign_funcs"](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[DEBUG   ] The functions from module 'boto_cloudfront' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_cloudtrail' are being loaded by dir() on the loaded module
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_cloudwatch. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_cloudwatch.py", line 74, in __virtual__
    __utils__["boto.assign_funcs"](
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_cloudwatch.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_cloudwatch', please fix this.
[DEBUG   ] The functions from module 'boto_cloudwatch_event' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_cognitoidentity' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_datapipeline' are being loaded by dir() on the loaded module
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_dynamodb. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_dynamodb.py", line 90, in __virtual__
    __utils__["boto.assign_funcs"](__name__, "dynamodb2", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_dynamodb.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_dynamodb', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_ec2. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_ec2.py", line 87, in __virtual__
    __utils__["boto.assign_funcs"](__name__, "ec2", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_ec2.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_ec2', please fix this.
[DEBUG   ] The functions from module 'boto_efs' are being loaded by dir() on the loaded module
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_elasticache. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_elasticache.py", line 76, in __virtual__
    __utils__["boto.assign_funcs"](__name__, "elasticache", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_elasticache.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_elasticache', please fix this.
[DEBUG   ] The functions from module 'boto_elasticsearch_domain' are being loaded by dir() on the loaded module
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_elb. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_elb.py", line 81, in __virtual__
    __utils__["boto.assign_funcs"](__name__, "elb", module="ec2.elb", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_elb.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_elb', please fix this.
[DEBUG   ] The functions from module 'boto_elbv2' are being loaded by dir() on the loaded module
[DEBUG   ] Error loading module.boto_iam: __init__ failed
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 902, in _load_module
    self.run(module_init, self.opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_iam.py", line 75, in __init__
    __utils__["boto.assign_funcs"](__name__, "iam", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[DEBUG   ] The functions from module 'boto_iot' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_kinesis' are being loaded by dir() on the loaded module
[DEBUG   ] Error loading module.boto_kms: __init__ failed
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 902, in _load_module
    self.run(module_init, self.opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_kms.py", line 69, in __init__
    __utils__["boto.assign_funcs"](__name__, "kms", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[DEBUG   ] The functions from module 'boto_lambda' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_rds' are being loaded by dir() on the loaded module
[DEBUG   ] Error loading module.boto_route53: __init__ failed
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 902, in _load_module
    self.run(module_init, self.opts)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_route53.py", line 82, in __init__
    __utils__["boto.assign_funcs"](__name__, "route53", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[DEBUG   ] The functions from module 'boto_s3' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_s3_bucket' are being loaded by dir() on the loaded module
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_secgroup. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_secgroup.py", line 82, in __virtual__
    __utils__["boto.assign_funcs"](__name__, "ec2", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_secgroup.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_secgroup', please fix this.
[ERROR   ] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_sns. Module will not be loaded: '__salt__'
Traceback (most recent call last):
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1150, in _process_virtual
    virtual = self.run(virtual_attr)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/boto_sns.py", line 69, in __virtual__
    __utils__["boto.assign_funcs"](__name__, "sns", pack=__salt__)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 159, in __call__
    ret = self.loader.run(run_func, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1245, in run
    return self._last_context.run(self._run_as, _func_or_method, *args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/lazy.py", line 1260, in _run_as
    return _func_or_method(*args, **kwargs)
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/utils/botomod.py", line 261, in assign_funcs
    if pack:
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 87, in __bool__
    return bool(self.value())
  File "/opt/saltstack/salt/lib/python3.10/site-packages/salt/loader/context.py", line 72, in value
    return loader.pack[self.name]
KeyError: '__salt__'
[WARNING ] salt.loaded.int.module.boto_sns.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_sns', please fix this.
[DEBUG   ] The functions from module 'boto_sqs' are being loaded by dir() on the loaded module
[DEBUG   ] The functions from module 'boto_ssm' are being loaded by dir() on the loaded module

defanator avatar Dec 13 '23 08:12 defanator

After deeper investigation, it turned out that reverting this change fixes the issue:

% git describe
v3006.4-1926-g84f434cc76

% git diff -r v3006.4 context.py 
diff --git a/salt/loader/context.py b/salt/loader/context.py
index 86f879cc59..6bbfe4dbd8 100644
--- a/salt/loader/context.py
+++ b/salt/loader/context.py
@@ -84,11 +84,7 @@ class NamedLoaderContext(collections.abc.MutableMapping):
         self.value()[item] = value
 
     def __bool__(self):
-        try:
-            self.loader
-        except LookupError:
-            return False
-        return True
+        return bool(self.value())
 
     def __len__(self):
         return self.value().__len__()

Corresponding commit with breaking changes: https://github.com/saltstack/salt/commit/989790cb90687d0bb8ec7a51135d693453ba62bc

cc/ @dwoz

defanator avatar Dec 13 '23 10:12 defanator

This issue also exist in salt-minion x86_64 3006.6-0 version

grzegorz-gn avatar Feb 07 '24 17:02 grzegorz-gn

Agreed. 3006.6. - same issue...

2024-02-09 13:28:05,357 [salt.loader.lazy :1167][ERROR   ][230522] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_cloudwatch. Module will not be loaded: '__salt__'
2024-02-09 13:28:05,358 [salt.loader.lazy :1179][WARNING ][230522] salt.loaded.int.module.boto_cloudwatch.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_cloudwatch', please fix this.
2024-02-09 13:28:05,370 [salt.loader.lazy :1167][ERROR   ][230522] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_ec2. Module will not be loaded: '__salt__'
2024-02-09 13:28:05,370 [salt.loader.lazy :1179][WARNING ][230522] salt.loaded.int.module.boto_ec2.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_ec2', please fix this.
2024-02-09 13:28:05,375 [salt.loader.lazy :1167][ERROR   ][230522] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_elasticache. Module will not be loaded: '__salt__'
2024-02-09 13:28:05,375 [salt.loader.lazy :1179][WARNING ][230522] salt.loaded.int.module.boto_elasticache.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_elasticache', please fix this.
2024-02-09 13:28:05,380 [salt.loader.lazy :1167][ERROR   ][230522] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_elb. Module will not be loaded: '__salt__'
2024-02-09 13:28:05,380 [salt.loader.lazy :1179][WARNING ][230522] salt.loaded.int.module.boto_elb.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_elb', please fix this.
2024-02-09 13:28:05,411 [salt.loader.lazy :1167][ERROR   ][230522] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_secgroup. Module will not be loaded: '__salt__'
2024-02-09 13:28:05,411 [salt.loader.lazy :1179][WARNING ][230522] salt.loaded.int.module.boto_secgroup.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_secgroup', please fix this.
2024-02-09 13:28:05,413 [salt.loader.lazy :1167][ERROR   ][230522] Exception raised when processing __virtual__ function for salt.loaded.int.module.boto_sns. Module will not be loaded: '__salt__'
2024-02-09 13:28:05,413 [salt.loader.lazy :1179][WARNING ][230522] salt.loaded.int.module.boto_sns.__virtual__() is wrongly returning `None`. It should either return `True`, `False` or a new name. If you're the developer of the module 'boto_sns', please fix this.

AGirin avatar Feb 09 '24 19:02 AGirin

Confirming that 3006.6 still include this bug.

defanator avatar Feb 10 '24 04:02 defanator

I've confirmed this is fixed by https://github.com/saltstack/salt/pull/65696, I thought that went out with 3006.5 but was wrong. It'll be fixed in 3006.7.

dwoz avatar Feb 11 '24 21:02 dwoz

Just wondering if there's timing on the 3006.7 release?

jrehrenfeld avatar Feb 12 '24 16:02 jrehrenfeld

Just wondering if there's timing on the 3006.7 release?

We're held up by some failures in the test pipeline. Once they are resolved we'll do the release. Hopefully this week, if not, next.

dwoz avatar Feb 12 '24 19:02 dwoz

Fixed in 3006.7

dwoz avatar May 01 '24 21:05 dwoz