Skip to content

feat: Try multiple hash funcs files.get and files.put #1380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: 3.x
Choose a base branch
from

Conversation

mrkbac
Copy link

@mrkbac mrkbac commented Jun 22, 2025

Support more hash functions for files.put, files.get, on machine I'm working with does not support the sha1 commands, So with this PR md5, sha1,sha264 are tries in this order

Maybe this should be configurable?

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

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

Nice, this is awesome stuff @mrkbac! Two minor comments to addres 🙏

if local_sum != remote_sum:
sum_match = False
for fact, get_sum in [
# md5 is most common, so check it first
Copy link
Member

Choose a reason for hiding this comment

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

I think we should use sha1 as the first/default here to match the current implementation.

# Check sha1sum, upload if needed
if local_sum != remote_sum:
sum_match = False
for fact, get_sum in [
Copy link
Member

Choose a reason for hiding this comment

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

Probably makes sense to put this block into a util function and de-dupe with the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants