You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add ASA pre-transfer free-space check (NAPPS-1087)
Implements the fail-open pre-transfer free-space check on Cisco ASA
using the seam added in NAPPS-1091 (PR #370). Image transfers now
fail fast when ``disk0:`` lacks room instead of half-writing flash.
- ASADevice._get_free_space parses the ``(N bytes free)`` trailer from
``dir`` output (same format EOS exposes).
- file_copy calls _check_free_space with os.path.getsize on the local
source before any SCP transfer.
- remote_file_copy calls _pre_transfer_space_check inside the existing
``not verify_file`` block so the check only fires when a transfer
would actually happen; still fail-open when src.file_size_bytes is
None.
- Unit tests cover the dir-trailer parse, the missing-trailer raise,
file_copy raising before SCP, remote_file_copy raising before any
copy command, and the fail-open path spying on _check_free_space.
- Existing file_copy unit tests updated to mock os.path.getsize and
_check_free_space (previously they passed a non-existent path that
would now blow up on os.path.getsize).
- Integration tests mirror the EOS pattern for manual lab runs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Add NAPPS-1087 changelog fragment
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Apply ruff format to ASA integration tests
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Broaden ASA dir free-space regex for real-device trailer
Real ASA platforms print the dir trailer as
``(<N> bytes free/<pct>% free)`` — the closing paren is not adjacent
to ``free``. The previous regex anchored on ``\)`` and so would have
failed on live hardware (verified against an ASA 5512 running 9.9.2
at 10.1.100.80, which reports
``4118732800 bytes total (3580170240 bytes free/86% free)``). Drop
the trailing ``\)`` anchor and update the mock fixture + tests to
cover both the real-device shape and the legacy
``(N bytes free)`` emulator shape.
Bumped the ``test_remote_file_copy_raises_not_enough_free_space``
oversize from 2 GB to 10 GB because the mock now reports ~3.3 GB
free — 2 GB fits, 10 GB does not.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Added a pre-transfer free-space check to Cisco ASA ``file_copy`` and ``remote_file_copy`` that raises ``NotEnoughFreeSpaceError`` when the target filesystem lacks room for the image.
0 commit comments