certbot/tools
ohemorange ab34e5dcf7
Check to see if launchpad snap build put html in the .snap file (#10646)
Fixes #10617

I restructured the conditionals to avoid too much nesting. This should
have the same effect, just with the additional check conditioned on all
the target snap files being available. Here is the logic I used for the
restructuring:

start

```python
dump_output = exit_code != 0 or failed_archs
if exit_code == 0 and not failed_archs:
    # We expect to have all target snaps available, or something bad happened.
    snaps_list = glob.glob(join(workspace, '*.snap'))
    if not len(snaps_list) == len(archs):
        print('Some of the expected snaps for a successful build are missing '
              f'(current list: {snaps_list}).')
        dump_output = True
    else:
        build_success = True
        break
```

note that `(exit_code == 0 and not failed_archs) == not (exit_code != 0
or failed_archs) == not dump_output`

```python
dump_output = exit_code != 0 or failed_archs
if not dump_output:
    # We expect to have all target snaps available, or something bad happened.
    snaps_list = glob.glob(join(workspace, '*.snap'))
    if not len(snaps_list) == len(archs):
        print('Some of the expected snaps for a successful build are missing '
              f'(current list: {snaps_list}).')
        dump_output = True
    else:
        build_success = True
        break
```

distribute the if

```python
dump_output = exit_code != 0 or failed_archs
snaps_list = glob.glob(join(workspace, '*.snap'))
if not dump_output and (not len(snaps_list) == len(archs)):
    # We expect to have all target snaps available, or something bad happened.
    print('Some of the expected snaps for a successful build are missing '
          f'(current list: {snaps_list}).')
    dump_output = True
    
if not dump_output and (len(snaps_list) == len(archs)): # redundant; if it were false, we would have changed dump_output right above this
    build_success = True
    break
```

remove redundant check

```python
dump_output = exit_code != 0 or failed_archs
snaps_list = glob.glob(join(workspace, '*.snap'))
if not dump_output and (not len(snaps_list) == len(archs)):
    # We expect to have all target snaps available, or something bad happened.
    print('Some of the expected snaps for a successful build are missing '
          f'(current list: {snaps_list}).')
    dump_output = True
    
if not dump_output:
    build_success = True
    break
```

As this shows, we can now add additional checks that only happen if we
think we're in danger of succeeding based on checks thus far, and simply
change `dump_output` to `True` if the additional check fails.

You can see the build step failing when the [file contains
html](https://github.com/certbot/certbot/compare/html-problem...refs/heads/test-html-problem-2)
at
https://github.com/certbot/certbot/actions/runs/26071811878/job/76654623490#step:5:42
2026-05-19 12:27:11 -07:00
..
docker update base docker image (#10620) 2026-04-13 12:21:34 -07:00
pinning Migrate certbot-dns-cloudflare to cloudflare 4.x SDK (#10587) 2026-05-06 09:35:38 -07:00
snap Check to see if launchpad snap build put html in the .snap file (#10646) 2026-05-19 12:27:11 -07:00
_release.sh stop running setup.py and switch to python -m build (#10442) 2025-08-22 11:03:00 -07:00
extract_changelog.py Run changelog generation stage on ubuntu-latest, nightly (#10349) 2025-06-20 09:38:34 -07:00
finish_release.py fix finish_release.py (#10503) 2025-12-04 15:15:25 -08:00
notify_mattermost.py Add @ing mattermost notifications to release build successes and failures (#10604) 2026-04-02 14:14:27 -07:00
oldest_constraints.txt Migrate certbot-dns-cloudflare to cloudflare 4.x SDK (#10587) 2026-05-06 09:35:38 -07:00
pip_install.py Drop in uv for pip (#10428) 2025-08-18 13:17:02 -07:00
pipstrap.py Always "pipstrap" when running pip_install.py (#9658) 2023-04-05 16:43:26 -07:00
release.sh switch from gpg2 to gpg (#9985) 2024-08-19 15:24:39 -07:00
requirements.txt repin dependencies (#10645) 2026-05-18 12:49:59 -07:00
retry.sh Automatically retry test farm tests (#8325) 2020-09-30 17:05:52 -07:00
sphinx-quickstart.sh update intersphinx mapping (#10074) 2024-12-03 11:16:13 -08:00
venv.py remove python 3.9 support (#10406) 2025-08-12 17:49:02 +00:00