Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] boto3mod requires boto #62672

Closed
4 tasks
bdrx312 opened this issue Sep 13, 2022 · 2 comments · Fixed by #63135
Closed
4 tasks

[BUG] boto3mod requires boto #62672

bdrx312 opened this issue Sep 13, 2022 · 2 comments · Fixed by #63135
Labels
boto AWS wrapper modules Bug broken, incorrect, or confusing behavior needs-triage

Comments

@bdrx312
Copy link
Contributor

bdrx312 commented Sep 13, 2022

Description

The boto3mod utils module imports the old boto module (

import boto
) and not just boto3 and botocore modules. This therefore requires boto (not just boto3) to be installed to use the boto3_ specific execution modules like boto3_sns (https://github.com/saltstack/salt/blob/master/salt/modules/boto3_sns.py), boto3_route53 (https://github.com/saltstack/salt/blob/master/salt/modules/boto3_route53.py), boto3_elasticsearch (https://github.com/saltstack/salt/blob/master/salt/modules/boto3_elasticsearch.py), and boto3_elasticache (https://github.com/saltstack/salt/blob/master/salt/modules/boto3_elasticache.py) since they use __utils__["boto3.assign_funcs"]

Setup

  • AWS ec2 instance running RHEL 7.9
  • Install salt-minion yum install salt-minion
  • Install boto3 and botocore but not boto /usr/bin/pip3 install boto3
  • Configure host for masterless: in /etc/salt/minion set master_type: disable and file_client: local

Steps to Reproduce the behavior

$ /usr/bin/pip3 freeze
boto3==1.17.98
botocore==1.20.98
chardet==3.0.4
contextvars==2.4
distro==1.2.0
idna==2.10
immutables==0.14
Jinja2==2.11.1
jmespath==0.10.0
M2Crypto==0.35.2
MarkupSafe==0.23
msgpack==0.6.2
psutil==5.6.7
pycurl==7.43.0
PySocks==1.6.8
python-dateutil==2.8.1
PyYAML==3.13
pyzmq==17.0.0
requests==2.14.2
rpm==4.11.3
s3transfer==0.4.2
salt==3004.1
six==1.14.0
urllib3==1.25.6

salt-call --local -l debug boto3_elasticsearch.describe_elasticsearch_domains

[DEBUG   ] Error loading module.boto3_elasticsearch: __init__ failed
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/salt/loader/lazy.y", line 883, in _load_module
    self.run(module_init, self.opts)
...
 File "/usr/lib/python3.6/site-packges/salt/modules/boto3_elasticsearch.py", line 94, in __init__
    __utils__["boto3.assign_funcs"](__name__, "es")
...
  File "/usr/lib/python3.6/site-packages/salt/utils/lazy.py, line 105, in __getitem__
    raise KeyError(key)
KeyError: 'boto3.assign_funcs'
[DEBUG   ] Could not LazyLoad boto3.assign_funcs: 'boto3.assign_funcs' is not available.
'boto3_elasticsearch' __virtual__ returned False: __init__ failed

Expected behavior

boto3_elasticsearch __virtual__ should return True since only boto3 should be required and not boto
There should not be a KeyError calling boto3.assign_funcs

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Salt Version:
  Salt: 3004.1
@bdrx312 bdrx312 added Bug broken, incorrect, or confusing behavior needs-triage labels Sep 13, 2022
@welcome
Copy link

welcome bot commented Sep 13, 2022

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@OrangeDog OrangeDog added the boto AWS wrapper modules label Sep 13, 2022
@bdrx312
Copy link
Contributor Author

bdrx312 commented Aug 15, 2024

The import boto was removed but the boto library still has to be installed because of

has_boto = salt.utils.versions.check_boto_reqs()

has_boto = salt.utils.versions.check_boto_reqs()

This needs to be changed to

has_boto = salt.utils.versions.check_boto_reqs(check_boto=False)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
boto AWS wrapper modules Bug broken, incorrect, or confusing behavior needs-triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants