Skip to content

Commit

Permalink
tests: force version of cloud-init from PPA regardless of version (#5251
Browse files Browse the repository at this point in the history
)

The PPA provided to CLOUD_INIT_CLOUD_INIT_SOURCE can contain a lower
version of cloud-init than what is currently released for a given
series. In those cases install an apt preferences file to pin
the cloud-init installed to the given PPA regardless of the published
version.
  • Loading branch information
blackboxsw committed May 2, 2024
1 parent 8b12a65 commit 237d957
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/integration_tests/instances.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
import logging
import os
import re
import uuid
from enum import Enum
from pathlib import Path
Expand Down Expand Up @@ -217,10 +218,20 @@ def install_ppa(self):
assert self.execute(
"apt install -qy software-properties-common"
).ok
pin_origin = self.settings.CLOUD_INIT_SOURCE[4:] # Drop leading ppa:
pin_origin = re.sub("[^a-z0-9-]", "-", pin_origin)
self.write_to_file(
"/etc/apt/preferences.d/cloud-init-integration-testing",
f"package: cloud-init\nPin: release o=LP-PPA-{pin_origin}\n"
"Pin-Priority: 1001\n",
)
assert self.execute(
"add-apt-repository {} -y".format(self.settings.CLOUD_INIT_SOURCE)
).ok
assert self.execute("apt-get install -qy cloud-init").ok
# PIN this PPA as priority for cloud-init installs regardless of ver
assert self.execute(
"apt-get install -qy cloud-init --allow-downgrades"
).ok

@retry(tries=30, delay=1)
def install_deb(self):
Expand Down

0 comments on commit 237d957

Please sign in to comment.