11 Commits

Author SHA1 Message Date
Fabian Ebner
13cdf8d1df check repos: have caller specify the current suite
Like that, a potential error is further up the stack, and it's more
consistent with what the standard_repository functions do.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Fabian Ebner
f48c12b00a standard repos: add suite parameter for stricter detection
Require that the suite matches too when detecting standard
repositories, since no or invalid updates will be obtained when the
suite is wrong. Thus, it should not be considered to be the same
repository.

Add the parameter for get_standard_repository too, so that the two
related calls have more similar parameters, and the detection of the
current release code name can be done once in the caller once.

This also will fix an issue with the front-end, where adding a
standard repository would end up just enabling an already present
repository with the wrong suite.

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Fabian Ebner
2a1fb9bfdd standard repo detection: handle alternative URI for PVE repos
For PVE, URIs without the final "/pve" are also valid.

Make the single URL response a vector and iterate over it, lower
index is preferred.

Reported in the community forum:
https://forum.proxmox.com/threads/pve-7-0-9-no-proxmox-ve-repository-enabled.92427/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
[ Thomas: extend commit message slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-16 15:21:21 +02:00
Fabian Ebner
9a51a30f46 tests: parse and write the result again
A cheap way to "double" the number of test cases.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-02 13:04:00 +02:00
Fabian Ebner
3c4e441d7c standard repos: allow conversion from handle and improve information
Add a description for the handle, which can be useful to display
alongside the name. The descriptions are essentially the first
sentence from PVE's "Package Repositories" docs, but without the
product name.

Also drop the " Repository" suffix from the names, as it's not useful,
but can be ugly: e.g. for the UI when the label already is
'Repository:'.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-30 20:38:05 +02:00
Fabian Ebner
3f7152383b standard repos: drop product acronym from repo name
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-30 13:24:42 +02:00
Fabian Ebner
87ea23ec83 check: return 'origin' property instead of 'badge' for official host
which is obtained from the cached InRelease file and also works for
mirrors, host aliases, direct IPs.

The has_official_uri function was replaced by origin_from_uris.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-30 13:24:42 +02:00
Fabian Ebner
bb0ff2ac73 add get_cached_origin method and an initial config module
Allows obtaining the 'Origin' property from the cached InRelease file.

Used the once_cell crate for the config module, because it is already
used in proxmox-backup and seemed to be the right fit here.

For now, the config module is just used to be able to override the
path for the test environment, but those are actual APT config
variables, and in the future, it can be extended and used to actually
parse the apt.conf(.d/*) on the system.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-30 13:24:42 +02:00
Fabian Ebner
8ada17854d add handling of Proxmox standard repositories
Get handles for the available repositories along with their current
configuration status and make it possible to add them.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-23 16:00:30 +02:00
Fabian Ebner
76d3a5ba1f add more functions to check repositories
Currently includes check for suites and check for official URIs

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-23 16:00:30 +02:00
Fabian Ebner
b6be0f3940 initial commit
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-23 16:00:30 +02:00