I have modified the test script to install the package in proposed:
----------------------------------------------------------------------
import pycloudlib
import os
lxd = pycloudlib.LXDVirtualMachine("vm")
name = 'pycloudlib-vm'
release = "hirsute"
pub_key_path = "lxd-pubkey"
priv_key_path = "lxd-privkey"
userdata_cloud_id_fail = """\
#cloud-config
bootcmd:
- cp /usr/bin/cloud-id /usr/bin/cloud-id.orig
- 'echo "error" > /usr/bin/cloud-id'
- chmod 755 /usr/bin/cloud-id
"""
pub_key, priv_key = lxd.create_key_pair()
with open(pub_key_path, "w") as f:
f.write(pub_key)
with open(priv_key_path, "w") as f:
f.write(priv_key)
lxd.use_key(
public_key_path=pub_key_path,
private_key_path=priv_key_path
)
image_id = lxd.released_image(release=release)
instance = lxd.launch(
name=name,
image_id=image_id,
user_data=userdata_cloud_id_fail
)
print("--- Creating base instance")
print("ip address: ", instance.ip)
print("--- Make cloud-id command fail by changing the binary")
cloud_id = instance.execute("cloud-id")
print(cloud_id.stderr)
print("--- Running postinst script for current version of uaclient")
dpkg_out = instance.execute("sudo dpkg-reconfigure ubuntu-advantage-tools")
print(instance.execute("ua version"))
print(dpkg_out.stderr)
print("------------------")
cmd = "sudo sh -c \"echo 'deb http://archive.ubuntu.com/ubuntu/ {}-proposed
restricted main multiverse universe' >>
/etc/apt/sources.list.d/proposed-repositories.list\""
print("--- Updating ua package")
out = instance.execute(cmd.format(release))
instance.execute("sh -c 'sudo apt-get update -q > /dev/null'")
instance.execute("sh -c 'sudo apt-get install ubuntu-advantage-tools >
/dev/null'")
print(instance.execute("ua version"))
dpkg_out = instance.execute("sudo dpkg-reconfigure ubuntu-advantage-tools")
print(dpkg_out.stderr)
print("------------------")
instance.delete()
--------------------------------------------
Currently, pycloudlib doesn't support launching hirsute or impish vms
Therefore, the test results here are for xenial, bionic and focal.
I will run this test for hirsute and impish through multipass.
PS: this bug should not affect xenial releases
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1938207
Title:
ubuntu-advantage-tools.postinst and cloud-id are not robust against
failure
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1938207/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs