elway: upload with content-hash idempotency (like ansible.copy) #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Today
upload:steps always reportchangedafter a successful scp+chmod. Ansible'scopymodule compares local+remote sha256 and reports unchanged when they match. Would turn upload into a first-class idempotent operation.Proposal
Before scp:
sha256sum <dest> 2>/dev/null— capture remote hash.ok(the file was already the desired content) rather thanchanged.Existing
creates:already covers "skip if path exists", but that's coarse — doesn't re-upload on content change. Hash check is the proper semantic.Edge cases
mode:on a file that already has correct content but wrong perms — should reportchanged(perm did change) even though bytes didn't.shasum -a 256oropenssl dgst -sha256if the first fails.LOE
~40-60 LOC. Lives inside
run_upload_stepplus one helper.Why file separately
For bytes-on-disk workloads this would eliminate spurious "changed" on re-runs of upload-heavy playbooks (every deploy currently shows as
changedeven when nothing moved). But it requires consistent hash tooling on every remote, which is fine for Linux hosts but worth documenting.