Skip to content

fix(operations.files): raise when a put time reference file is missing - #2127

Open
itzzdev09 wants to merge 1 commit into
pyinfra-dev:3.xfrom
itzzdev09:fix-timespec-raise
Open

itzzdev09 wants to merge 1 commit into
pyinfra-dev:3.xfrom
itzzdev09:fix-timespec-raise

Conversation

@itzzdev09

Copy link
Copy Markdown

files.put(..., mtime=...) / atime=... accept a path to a remote reference file. When that file does not exist, _canonicalize_timespec built a ValueError but never raised it, so it returned None and the operation crashed later with an unrelated message:

AttributeError: 'NoneType' object has no attribute 'tzinfo'

This raises the error (and fixes the timesspec typo in its message), so the user sees ValueError: Bad argument for timespec: /var/missing.blob.

  • 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 (no behaviour change to document)
  • Tests pass (see scripts/dev-test.sh) — tests/test_operations.py -k files.put: 25 passed; the new fixture files.put/error_mtime_ref_missing.json fails on 3.x with the AttributeError above
  • Type checking & code style passes (see scripts/dev-lint.sh) (not run locally; one-line change)
  • Pull request title follows the conventional commits format

@wowi42 wowi42 added bug Label for all kind of bugs. operations Issues with operations. labels Dec 1, 2026
@itzzdev09 itzzdev09 changed the title fix(files): raise when a put time reference file is missing fix(operations.files): raise when a put time reference file is missing Dec 1, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Label for all kind of bugs. operations Issues with operations.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants