Unable to mirror Ubuntu Cloud Archive due to incompatibility with path name fragment
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Landscape Server |
New
|
Undecided
|
Unassigned |
Bug Description
The naming convention of the paths found in a 'standard' Ubuntu archive are supported by Landscape when mirroring, but the paths that are used in Ubuntu Cloud Archive (uca) contain an additional fragment which is not supported by Landscape's repo parser.
We have at least one customer directly impacted by this and they cannot move forward without this being addressed.
For example, mirroring Jammy would include a repository path that looks like:
ubuntu/
While attempting to mirror the Jammy-Yoga UCA endpoint for OpenStack packages, looks like:
ubuntu/
Note the additional branch for the OpenStack release in this fragment (/yoga/). This currently breaks Landscape's ability to mirror this repository.
One workaround proposed would be to make a change on the _infrastructure_ side, inside the actual UCA repository hierarchy itself, by creating a symlink tree back to the collapsed naming convention so Landscape isn't confused and can mirror those packages.
A working pseudocode shell snippet that would create this looks like:
for series in *; do
if [[ -d "${series}" ]]; then
for pocket in "${series}"/*; do
ln -sf "${series}
done
fi
done
This effectively will collapse one child directory into a symlink (/jammy-
As Landscape is a first-class citizen product, it should be able to handle the package repositories used by Canonical products, including the main repositories and the cloud-archive repositories.
This is only a stopgap, but the problem really does lie on the Landscape server side, not the repository layout itself.
Or whatever tooling is appropriate to merge that naming into a symlink at that level. It would be unique to each of the pockets.
information type: | Proprietary → Public |
tags: | added: low-hanging-fruit |
Hello Landscape Team!
I was also struggling with this issue and finally had some time to spare to get to the bottom of it.
It appears that some sort of input validation is blocking "--pockets" parameter from accepting slashes. If we modify the code to allow that, everything else should work fine after that.
Example input and the error:
$ landscape-api create-series --pockets updates/yoga --components main --architectures amd64 --gpg-key secret-key --mirror-gpg-key cloud-archive-key --mirror-uri http:// ubuntu- cloud.archive. canonical. com/ubuntu/ --mirror-series focal focal-yoga cloud
Got server error: rValue
Status: 400
Error code: InvalidParamete
Error message: Invalid unicode value updates/yoga
I discovered a simple workaround, which is manually updating the record in the PostgreSQL DB. Essentially, pass a "valid" value to --pockets, then fix it in the DB:
$ landscape-api create-series --pockets updates --components main --architectures amd64 --gpg-key secret-key --mirror-gpg-key cloud-archive-key --mirror-uri http:// ubuntu- cloud.archive. canonical. com/ubuntu/ --mirror-series focal focal-yoga cloud
(Fix Path in Database / Juju deployed example here)
$ juju ssh postgresql/0
$ sudo -u postgres psql -d landscape-account-1
landscape- account- 1=# select * from pocket where mirror_uri like '%cloud%'; allow_unsigned | components | archs | include_udeb | filter_type | filters | creation_time ------- --+---- -----+- -----+- ------- ----+-- ------- ------- ------- ------- ------- ------- ------- +------ ------- --+---- ------- ------- -+----- ------- ----+-- ------- ------- ------- +------ ------+ ------- --+---- ------- ---+--- ------- ---+--- ------+ ------- ------- ------- ------- ubuntu- cloud.archive. canonical. com/ubuntu/ | focal-updates | 4 | | | {main} | {amd64} | f | | {} | 2023-10-29 20:52:58.989255
id | series_id | name | mode | gpg_key_id | mirror_uri | mirror_suite | mirror_gpg_key_id | pull_pocket_id | upload_
----+--
18 | 14 | updates | 0 | 2 | http://
(1 row)
landscape- account- 1=# update pocket set mirror_ suite=' focal-updates/ yoga' where id=18;
UPDATE 1
(Sync)
$ landscape-api sync-mirror-pocket updates focal-yoga cloud
Also a side note, today I found out that the "name" parameter in the create-series command has the same validation and does not accept dots:
Example input:
$ landscape-api create-series --pockets updates --components main --architectures amd64 --gpg-key secret-key --mirror-gpg-key cloud-archive-key --mirror-uri http:// ubuntu- cloud.archive. canonical. com/ubuntu/ --mirror-series focal focal-ovn-22.03 cloud
This command fails with the same "Invalid unicode value" error.
After the database updates are done, everything else should work as normal going forward:
(Initial Association) repository- profile --description "Cloud Archive Repos - Focal" focal-cloud- repo-profile to-repository- profile focal-cloud- repo-profile updates focal-yoga cloud
$ landscape-api create-
$ landscape-api add-pockets-
(Then from Juju) focal,focal- cloud"
$ juju config lds-client-focal tags="vstack,
(Final Association...