saltstack-formulas/packages-formula

[FEATURE] (archive.sls) Keep idempotency if the wanted package is a file inside a tarball?

mdschmitt opened this issue · 0 comments

Is your feature request related to a problem?

Every time I run state.apply, it module.runs file.check_hash and extracts the binary from the tarball.

Describe the solution you'd like

I'm not exactly sure how, but it'd be neat if things were idempotent when installing packages that are really just binaries inside tarballs.

Describe alternatives you've considered

N/A

Additional context

I could absolutely be misusing it, so maybe there's a better way?
Pillar:

packages:
  tmpdir: /var/cache/salt/minion/extrn_files
  archives:
    wanted:
      rg:
        dest: /usr/local/bin
        dl:
          format: tar
          source: https://github.com/BurntSushi/ripgrep/releases/download/13.0.0/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz
          hashsum: ee4e0751ab108b6da4f47c52da187d5177dc371f0f512a7caaec5434e711c091
        options: '--strip-components=1 --no-same-owner ripgrep-13.0.0-x86_64-unknown-linux-musl/rg'

Output on state.apply regardless of whether or not the file's already there and correct:

      ID: packages-archive-wanted-rg-check-hashsum
Function: module.run
    Name: file.check_hash
  Result: True
 Comment: Module function file.check_hash executed
 Started: 00:45:00.061936
Duration: 6.53 ms
 Changes:
          ----------
          ret:
              True

      ID: packages-archive-wanted-install-rg
Function: archive.extracted
    Name: /usr/local/bin/
  Result: True
 Comment: /var/cache/salt/minion/extrn_files/ripgrep-13.0.0-x86_64-unknown-linux-musl.tar.gz extracted to /usr/local/bin/, due to absence of one or more files/dirs. Output was trimmed to False number of lines
 Started: 00:45:00.068953
Duration: 112.007 ms
 Changes:
          ----------
          extracted_files:
              - ripgrep-13.0.0-x86_64-unknown-linux-musl/rg