Bug 1576981

Summary: boto3.s3.transfer doesn't load the sys module before calling sys.path.insert()
Product: Red Hat Enterprise Linux 7 Reporter: Aron Parsons <aparsons>
Component: python-boto3Assignee: Oyvind Albrigtsen <oalbrigt>
Status: CLOSED ERRATA QA Contact: Brandon Perkins <bperkins>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 7.5CC: aherr, cfeist, jon.dufresne
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: python-boto3-1.4.6-5.el7 Doc Type: Bug Fix
Doc Text:
Due to a missing import of the sys module in boto3.s3.transfer, boto3.resource('s3') failed with the ImportException error message. This update adds the "import sys" statement in the code, and boto3.resource('s3') works as expected.
Story Points: ---
Clone Of:
: 1581763 1581764 (view as bug list) Environment:
Last Closed: 2018-10-30 10:13:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1581763, 1581764    

Description Aron Parsons 2018-05-10 21:40:57 UTC
Description of problem:
the s3 resource can't be used from boto3 because of a missing import of the "sys" module.


Version-Release number of selected component (if applicable):
python-boto3-1.4.6-4.el7.noarch


How reproducible:
always


Steps to Reproduce:
$ python
Python 2.7.5 (default, Apr 11 2018, 07:36:10) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import boto3


Actual results:
>>> boto3.resource('s3')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/boto3/__init__.py", line 92, in resource
    return _get_default_session().resource(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/boto3/session.py", line 391, in resource
    aws_session_token=aws_session_token, config=config)
  File "/usr/lib/python2.7/site-packages/boto3/session.py", line 265, in client
    aws_session_token=aws_session_token, config=config)
  File "/usr/lib/python2.7/site-packages/botocore/session.py", line 836, in create_client
    client_config=config, api_version=api_version)
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 65, in create_client
    cls = self._create_client_class(service_name, service_model)
  File "/usr/lib/python2.7/site-packages/botocore/client.py", line 90, in _create_client_class
    base_classes=bases)
  File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/usr/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/usr/lib/python2.7/site-packages/boto3/utils.py", line 61, in _handler
    module = import_module(module)
  File "/usr/lib/python2.7/site-packages/boto3/utils.py", line 52, in import_module
    __import__(name)
  File "/usr/lib/python2.7/site-packages/boto3/s3/inject.py", line 17, in <module>
    from boto3.s3.transfer import create_transfer_manager
  File "/usr/lib/python2.7/site-packages/boto3/s3/transfer.py", line 125, in <module>
    sys.path.insert(0, '/usr/lib/fence-agents/bundled')
NameError: name 'sys' is not defined


Expected results:
s3.ServiceResource()

Comment 10 errata-xmlrpc 2018-10-30 10:13:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2018:3124