saltstack / saltstack/salt

[BUG] s3.get doesn't work with actions

Open
#64,281 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

boto bug needs-triage
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
s3.get action=action doesn't work

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

  • Amazon AWS 4.15.0-1065-aws Ubuntu 2020 x86_64
  • salt is being installed through puppet

Steps to Reproduce the behavior
sudo salt myminion s3.get mybucket test.txt action=acl

Expected behavior
Should show the ACL

Screenshots
Not a screenshot but good enough.

    The minion function caused an exception: Traceback (most recent call last):
      File "/usr/lib/python3/dist-packages/salt/minion.py", line 1664, in _thread_return
        return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
      File "/usr/lib/python3/dist-packages/salt/executors/direct_call.py", line 12, in execute
        return func(*args, **kwargs)
      File "/usr/lib/python3/dist-packages/salt/modules/s3.py", line 204, in get
        https_enable=https_enable)
      File "/usr/lib/python3/dist-packages/salt/utils/s3.py", line 261, in query
        items = ET.fromstring(result.content)
      File "/usr/lib/python3.6/xml/etree/ElementTree.py", line 1314, in XML
        parser.feed(text)
      File "<string>", line None
    xml.etree.ElementTree.ParseError: syntax error: line 1, column 0

Versions Report

Salt Version:
           Salt: 2019.2.8

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.8.2
      docker-py: Not Installed
          gitdb: 2.0.3
      gitpython: 2.1.8
          ioflo: Not Installed
         Jinja2: 2.10
        libgit2: Not Installed
        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: Not Installed
         Python: 3.6.9 (default, Jun 29 2022, 11:45:57)
   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: 5.4.0-1063-aws
         system: Linux
        version: Ubuntu 18.04 bionic

Additional context
s3.get is probably always trying to get the file, ignoring the action parameter.
If I do

sudo salt myminion s3.get mybucket test.txt action=acl return_bin=True

it shows the file content.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the s3.get entry point in salt/modules/s3.py and follow its call into salt/utils/s3.py, especially query where the XML parse error occurs. Reproduce the command with action=acl and confirm that it returns the ACL rather than file content and no longer raises the parse error.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.