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

s3 pillar fails on python3 #54696

Open
rklaren opened this issue Sep 19, 2019 · 3 comments
Open

s3 pillar fails on python3 #54696

rklaren opened this issue Sep 19, 2019 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior Pillar python3 regarding Python 3 support severity-high 2nd top severity, seen by most users, causes major problems

Comments

@rklaren
Copy link
Contributor

rklaren commented Sep 19, 2019

Description of Issue

Configuring an S3 pillar and doing a pillar.items yields the following stack strace:

2019-09-19 21:56:46,081 [salt.pillar      :984 ][ERROR   ][5957] Exception caught loading ext_pillar 's3':
  File "/usr/lib/python3/dist-packages/salt/pillar/__init__.py", line 974, in ext_pillar
    key)
  File "/usr/lib/python3/dist-packages/salt/pillar/__init__.py", line 893, in _external_pillar_data
    ext = self.ext_pillars[key](self.minion_id, pillar, **val)
  File "/usr/lib/python3/dist-packages/salt/pillar/s3.py", line 162, in ext_pillar
    metadata = _init(s3_creds, bucket, multiple_env, environment, prefix, s3_cache_expire)
  File "/usr/lib/python3/dist-packages/salt/pillar/s3.py", line 220, in _init
    environment, prefix)
  File "/usr/lib/python3/dist-packages/salt/pillar/s3.py", line 347, in _refresh_buckets_cache_file
    pickle.dump(metadata, fp_)

Setup

The most simple s3 pillar setup.

Steps to Reproduce Issue

Configure S3 pillar, refer to it, things go boom.

Versions Report

Salt Version:
           Salt: 2019.2.0
 
Dependency Versions:
           cffi: Not Installed
       cherrypy: unknown
       dateutil: 2.6.1
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: 0.26.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.5.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.26.2
         Python: 3.6.8 (default, Aug 20 2019, 17:12:48)
   python-gnupg: 0.4.1
         PyYAML: 3.12
          PyZMQ: 16.0.2
           RAET: Not Installed
          smmap: 2.0.3
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.2.5
 
System Versions:
           dist: Ubuntu 18.04 bionic
         locale: UTF-8
        machine: x86_64
        release: 4.15.0-1047-aws
         system: Linux
        version: Ubuntu 18.04 bionic

The minion I used for testing is the master with the same versions.

The fix is to open the cache file in binary write mode:

    log.debug('Writing S3 buckets pillar cache file %s')

    with salt.utils.files.fopen(cache_file, 'wb') as fp_:
        pickle.dump(metadata, fp_)

I'll make a PR after some more testing.

rklaren added a commit to rklaren/salt that referenced this issue Sep 20, 2019
@Akm0d Akm0d added this to the Approved milestone Dec 3, 2019
@Akm0d Akm0d added this to Backlog in Neon Dec 3, 2019
@Akm0d Akm0d added Bug broken, incorrect, or confusing behavior Pillar and removed needs-triage labels Dec 5, 2019
@stale
Copy link

stale bot commented Jan 7, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 7, 2020
@rklaren
Copy link
Contributor Author

rklaren commented Jan 7, 2020

I reckon it's a bit early to close this bug.

@stale
Copy link

stale bot commented Jan 7, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 7, 2020
@sagetherage sagetherage removed this from Backlog in Neon Jan 24, 2020
@sagetherage sagetherage added python3 regarding Python 3 support severity-high 2nd top severity, seen by most users, causes major problems labels Apr 22, 2021
@sagetherage sagetherage added the Phosphorus v3005.0 Release code name and version label Jun 18, 2021
@sagetherage sagetherage modified the milestones: Approved, Phosphorus Jun 18, 2021
@Ch3LL Ch3LL removed the Phosphorus v3005.0 Release code name and version label Mar 30, 2022
@anilsil anilsil removed this from the Chlorine v3007.0 milestone May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Pillar python3 regarding Python 3 support severity-high 2nd top severity, seen by most users, causes major problems
Projects
None yet
Development

No branches or pull requests

7 participants