saltstack / saltstack/salt

[BUG] S3 Module / State Configuration Not Aligned

Open
#60,222 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

The S3 module expects the s3 configuration to be:

s3.key: key
s3.location: eu-west-1

Code: https://github.com/saltstack/salt/blob/master/salt/modules/s3.py

Docs:

Warning

This is literally the pillar key s3.keyid or the config option s3.keyid, not:

s3:
  keyid: blah

However, when using s3:// as a file source - s3_opt uses ['s3']['key']

https://github.com/saltstack/salt/blob/4f3cb36955d84c6793efcbeabf53963067922d90/salt/fileclient.py#L554

Setup

This means that a backup and restore state like this will never work unless the s3 configuration is duplicated.

letsencrypt-create-backup:
  cmd.run:
    - name: tar -cvf /tmp/letsencrypt.tar ./letsencrypt
    - cwd: /etc

letsencrypt-upload-backup:
  module.run:
    - name: s3.put
    - bucket: {{ pillar['s3']['bucketName'] }}
    - local_file: /tmp/letsencrypt.tar
    - path: {{ grains.nodename }}/letsencrypt.tar

teleport-s3-sync-down:
  archive.extracted:
    - name: /etc
    - source: s3://{{ pillar['s3']['bucketName'] }}/{{ grains.nodename }}/letsencrypt.tar
    - skip_verify: True
    - user: root
    - group: root
    - if_missing: /etc/letsencrypt
    

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 by comparing configuration handling in salt/modules/s3.py with the s3_opt lookup in salt/fileclient.py around line 554. Reproduce the documented S3 settings with the backup and restore state shown in the issue, then verify that the same configuration works for both s3.put and an s3:// file source without duplication.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.