salt icon indicating copy to clipboard operation
salt copied to clipboard

wip: archive.extrated fixes

Open Oloremo opened this issue 3 years ago • 0 comments

What does this PR do?

Fixes three small issues with archive.extrated state.

Previous Behavior

  1. Cleanup would not happen if clean_parent was set.
  2. top directory was created without setting the group
  3. ownership enforcement could be applied against root directory - "/"

Clarification regarding 1.

clean and clean_parent are mutually exclusive parameters. When clean_parent was added that part of the logic was missed.

Clarification regarding 2.

Top directory creation only considers owner archive.extracted parameter and ignores group. We can argue if it's a bugfix or new feature, but it's a bugfix from my PoV. Minions usually run from the root user and archive.extracted top directory will always have a root group - seems wrong.

Clarification regarding 3.

$ ls -la
total 0
drwxr-xr-x   3 oloremo  wheel   96 Feb 23 11:03 .
drwxrwxrwt  23 root     wheel  736 Feb 23 11:03 ..
-rw-r--r--   1 oloremo  wheel    0 Feb 23 10:54 file1

$ tar -czvf /tmp/no_top_level.tgz .
./
./file1

$ tar -tvf /tmp/no_top_level.tgz
drwxr-xr-x oloremo/wheel     0 2022-02-23 11:03 ./
-rw-r--r-- oloremo/wheel     0 2022-02-23 10:54 ./file1

New Behavior

  1. Cleanup will be triggered with either clean or clean_parent params set.
  2. top directory creation takes group into account
  3. ownership enforcement will never be applied against the root directory

Merge requirements satisfied?

  • [ ] Docs
  • [x] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
  • [ ] Tests written/updated

Commits signed with GPG?

Yes

Oloremo avatar Feb 23 '22 10:02 Oloremo