apt reads apt.conf.d in order and apt.conf last, and the last value wins. Reading 00proxy alone missed a proxy the Debian or Ubuntu installer wrote, and a fix that wrote 00proxy and read it back reported success while apt fetched elsewhere (NetOrk/netork#1397).
AptProxyMixin (napalm_device_types.apt_proxy) is PackageProxyMixin for a Debian-family host. Its form follows HostStatusMixin: the command and the parse live here, and a driver supplies _run_apt_command, _run_apt_root_command and _write_apt_file.
get_package_proxy_report(): the proxy from apt-config dump, per-host overrides and auto-detect, every line that sets it in apt's reading order (editable or inside a block, files apt skips left out), and the http and https sources.
check_package_proxy(url, expect): a fetch with apt-helper download-file, past any proxy. An HTTP error counts as an answer. The caller names the text the page should contain, so no product name lives here.
configure_package_proxy(url): the steps configure → conflicts (other lines commented out with sed -i by line number, only where the line still sets the proxy) → verify (apt-config again) → fetch (the InRelease of an http source that is not DIRECT).
same_proxy_url(): scheme, host and port, a trailing slash aside.
62 new tests: fixtures from real apt-helper output, sh -n on the commands, and one run against this host's apt. Version 4.22.0.
apt reads `apt.conf.d` in order and `apt.conf` last, and the last value wins. Reading `00proxy` alone missed a proxy the Debian or Ubuntu installer wrote, and a fix that wrote `00proxy` and read it back reported success while apt fetched elsewhere (NetOrk/netork#1397).
`AptProxyMixin` (`napalm_device_types.apt_proxy`) is `PackageProxyMixin` for a Debian-family host. Its form follows `HostStatusMixin`: the command and the parse live here, and a driver supplies `_run_apt_command`, `_run_apt_root_command` and `_write_apt_file`.
- `get_package_proxy_report()`: the proxy from `apt-config dump`, per-host overrides and auto-detect, every line that sets it in apt's reading order (editable or inside a block, files apt skips left out), and the http and https sources.
- `check_package_proxy(url, expect)`: a fetch with `apt-helper download-file`, past any proxy. An HTTP error counts as an answer. The caller names the text the page should contain, so no product name lives here.
- `configure_package_proxy(url)`: the steps configure → conflicts (other lines commented out with `sed -i` by line number, only where the line still sets the proxy) → verify (`apt-config` again) → fetch (the `InRelease` of an http source that is not `DIRECT`).
- `same_proxy_url()`: scheme, host and port, a trailing slash aside.
62 new tests: fixtures from real `apt-helper` output, `sh -n` on the commands, and one run against this host's apt. Version 4.22.0.
apt reads apt.conf.d in order and apt.conf last; the last value wins. The
Debian installer writes its proxy into apt.conf, Ubuntu's into
90curtin-aptproxy: reading 00proxy alone missed both, and a fix that wrote
00proxy and read it back reported success while apt fetched elsewhere.
- get_package_proxy_report(): apt-config dump's proxy, per-host overrides,
auto-detect, every line of apt's files that sets it (in reading order,
editable or inside a block), the http and https sources.
- check_package_proxy(url, expect): a fetch with apt-helper, past any proxy;
an HTTP error counts as an answer.
- configure_package_proxy(url): write 00proxy, comment out other proxy
lines, read apt's proxy back, fetch one InRelease through it.
- same_proxy_url(): scheme, host and port, a trailing slash aside.
A driver supplies _run_apt_command, _run_apt_root_command and
_write_apt_file. Version 4.22.0.
The NAPALM driver standard landed on main (#52, 4.21.1). apt_proxy follows
it: builtin generics, strict mypy, complexity 10 at most (parse_apt_proxy,
same_proxy_url and the comment-out step split into helpers), 100 % covered.
Its TypedDicts live in apt_proxy.py, since models.py is over 1000 lines and
may not grow. Version 4.22.0 with its CHANGELOG section.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
apt reads
apt.conf.din order andapt.conflast, and the last value wins. Reading00proxyalone missed a proxy the Debian or Ubuntu installer wrote, and a fix that wrote00proxyand read it back reported success while apt fetched elsewhere (NetOrk/netork#1397).AptProxyMixin(napalm_device_types.apt_proxy) isPackageProxyMixinfor a Debian-family host. Its form followsHostStatusMixin: the command and the parse live here, and a driver supplies_run_apt_command,_run_apt_root_commandand_write_apt_file.get_package_proxy_report(): the proxy fromapt-config dump, per-host overrides and auto-detect, every line that sets it in apt's reading order (editable or inside a block, files apt skips left out), and the http and https sources.check_package_proxy(url, expect): a fetch withapt-helper download-file, past any proxy. An HTTP error counts as an answer. The caller names the text the page should contain, so no product name lives here.configure_package_proxy(url): the steps configure → conflicts (other lines commented out withsed -iby line number, only where the line still sets the proxy) → verify (apt-configagain) → fetch (theInReleaseof an http source that is notDIRECT).same_proxy_url(): scheme, host and port, a trailing slash aside.62 new tests: fixtures from real
apt-helperoutput,sh -non the commands, and one run against this host's apt. Version 4.22.0.