Skip to content

Add archive compressed capability - #68571

Open
ironman627 wants to merge 3 commits into
saltstack:masterfrom
ironman627:master
Open

ironman627 wants to merge 3 commits into
saltstack:masterfrom
ironman627:master

Conversation

@ironman627

@ironman627 ironman627 commented Dec 29, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds compressed function to archive state module

What issues does this PR fix or reference?

N/A

New Behavior

Ability to compress files and directories

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

No

@twangboy

Copy link
Copy Markdown
Contributor

rebase once the nightly master branch is green

twangboy
twangboy previously approved these changes Apr 22, 2026
ironman627 and others added 3 commits June 26, 2026 05:38
- Rename changelog/archive-compressed.added.md to changelog/68571.added.md
  (towncrier requires numeric PR/issue ID in filename)
- Remove unused CommandNotFoundError import from test file
- Add pylint: disable=broad-except to catch-all exception handlers
- Fix trailing whitespace and black formatting issues
- Add blank line before compressed() function definition
Comment thread salt/states/archive.py
# Standard signature: archive.zip(zip_file, *sources, template=None, cwd=None, runas=None)
result = __salt__["archive.zip"](
name,
*sources,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a mismatch here. Look at how archive.zip (aliased from zip_) is actually defined:

def zip_(zip_file, sources, template=None, cwd=None, runas=None, zip64=False):

The Issue: It does not accept *args for sources. It expects exactly two main positional arguments: zip_file and sources (which can be a comma-separated string or a Python list).

Should probably be:

result = __salt__["archive.zip"](name, sources)

Regarding compression: The execution module hardcodes zipfile.ZIP_DEFLATED internally and doesn't expose a compression level parameter. You should document in the state that the compression argument is tar-only.

This branch was previously deployed

1 inactive deployment
ci — a7b0ff8e Deployed Jun 26, 2026 by dwoz via Build Onedir Packages / Windows (x86) #24782
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:full Run the full test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants