The following script was used to verify this issue:
----------------------------------
#!/bin/bash set -e
series=$1
name=$series-test
function cleanup { lxc delete $name --force }
function on_err { echo -e "Test Failed" cleanup exit 1 }
trap on_err ERR
if [ $series == "xenial" ]; then python_ver=3.5 cpython_ver="35m" elif [ $series == "bionic" ]; then python_ver=3.6 cpython_ver="36m" elif [ $series == "focal" ]; then python_ver=3.8 cpython_ver="38" elif [ $series == "jammy" ]; then python_ver=3.10 cpython_ver="310" elif [ $series == "kinetic" ]; then python_ver=3.10 cpython_ver="310" elif [ $series == "lunar" ]; then python_ver=3.11 cpython_ver="311" fi
function upgrade_to_latest { echo -e "\n-------------------------------------------" echo "** upgrading to 27.13.6" echo "-------------------------------------------" lxc exec $name -- apt-get update > /dev/null lxc exec $name -- apt-get install ubuntu-advantage-tools -y lxc exec $name -- apt-cache policy ubuntu-advantage-tools echo "-------------------------------------------" }
function upgrade_to_proposed { echo -e "\n-------------------------------------------" echo "** upgrading to 27.14.3 from proposed" echo "-------------------------------------------" lxc exec $name -- sh -c "echo \"deb http://archive.ubuntu.com/ubuntu $series-proposed main\" | tee /etc/apt/sources.list.d/proposed.list" lxc exec $name -- apt-get update > /dev/null lxc exec $name -- apt-get install ubuntu-advantage-tools -y lxc exec $name -- apt-cache policy ubuntu-advantage-tools echo "-------------------------------------------" }
function set_up_python3_env { echo -e "\n-------------------------------------------" echo "** Setting up python3 environment" echo "-------------------------------------------" lxc exec $name -- apt install python3-venv -y > /dev/null lxc exec $name -- python3 -m venv env lxc exec $name -- ln -s /usr/lib/python3/dist-packages/uaclient env/lib/python$python_ver/site-packages/uaclient lxc exec $name -- ln -s /usr/lib/python3/dist-packages/apt env/lib/python$python_ver/site-packages/apt lxc exec $name -- ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-$cpython_ver-x86_64-linux-gnu.so env/lib/python$python_ver/site-packages/apt_pkg.cpython-$cpython_ver-x86_64-linux-gnu.so echo "-------------------------------------------" }
lxc launch ubuntu-daily:$series $name sleep 5 upgrade_to_latest set_up_python3_env
echo -e "\n-------------------------------------------" echo "** Verify no yaml breaks esm-cache service" lxc exec $name -- sh -c ". ./env/bin/activate && python /usr/lib/ubuntu-advantage/esm_cache.py" || true lxc exec $name -- systemctl start esm-cache.service lxc exec $name -- systemctl status esm-cache.service || true echo "-------------------------------------------"
upgrade_to_proposed
echo -e "\n-------------------------------------------" echo "** Verify python3 config no longer breaks esm-cache service" lxc exec $name -- sh -c ". ./env/bin/activate && python /usr/lib/ubuntu-advantage/esm_cache.py" || true lxc exec $name -- systemctl start esm-cache.service lxc exec $name -- systemctl status esm-cache.service || true echo "-------------------------------------------"
cleanup
--------------------------
The following script was used to verify this issue:
------- ------- ------- ------- ------
#!/bin/bash
set -e
series=$1
name=$series-test
function cleanup {
lxc delete $name --force
}
function on_err {
echo -e "Test Failed"
cleanup
exit 1
}
trap on_err ERR
if [ $series == "xenial" ]; then ver="35m" ver="36m" ver="38" ver="310" ver="310" ver="311"
python_ver=3.5
cpython_
elif [ $series == "bionic" ]; then
python_ver=3.6
cpython_
elif [ $series == "focal" ]; then
python_ver=3.8
cpython_
elif [ $series == "jammy" ]; then
python_ver=3.10
cpython_
elif [ $series == "kinetic" ]; then
python_ver=3.10
cpython_
elif [ $series == "lunar" ]; then
python_ver=3.11
cpython_
fi
function upgrade_to_latest { ------- ------- ------- ------- ------- ----" ------- ------- ------- ------- ------- --" advantage- tools -y advantage- tools ------- ------- ------- ------- ------- --"
echo -e "\n----
echo "** upgrading to 27.13.6"
echo "------
lxc exec $name -- apt-get update > /dev/null
lxc exec $name -- apt-get install ubuntu-
lxc exec $name -- apt-cache policy ubuntu-
echo "------
}
function upgrade_to_proposed { ------- ------- ------- ------- ------- ----" ------- ------- ------- ------- ------- --" archive. ubuntu. com/ubuntu $series-proposed main\" | tee /etc/apt/ sources. list.d/ proposed. list" advantage- tools -y advantage- tools ------- ------- ------- ------- ------- --"
echo -e "\n----
echo "** upgrading to 27.14.3 from proposed"
echo "------
lxc exec $name -- sh -c "echo \"deb http://
lxc exec $name -- apt-get update > /dev/null
lxc exec $name -- apt-get install ubuntu-
lxc exec $name -- apt-cache policy ubuntu-
echo "------
}
function set_up_python3_env { ------- ------- ------- ------- ------- ----" ------- ------- ------- ------- ------- --" python3/ dist-packages/ uaclient env/lib/ python$ python_ ver/site- packages/ uaclient python3/ dist-packages/ apt env/lib/ python$ python_ ver/site- packages/ apt python3/ dist-packages/ apt_pkg. cpython- $cpython_ ver-x86_ 64-linux- gnu.so env/lib/ python$ python_ ver/site- packages/ apt_pkg. cpython- $cpython_ ver-x86_ 64-linux- gnu.so ------- ------- ------- ------- ------- --"
echo -e "\n----
echo "** Setting up python3 environment"
echo "------
lxc exec $name -- apt install python3-venv -y > /dev/null
lxc exec $name -- python3 -m venv env
lxc exec $name -- ln -s /usr/lib/
lxc exec $name -- ln -s /usr/lib/
lxc exec $name -- ln -s /usr/lib/
echo "------
}
lxc launch ubuntu- daily:$ series $name
sleep 5
upgrade_to_latest
set_up_python3_env
echo -e "\n---- ------- ------- ------- ------- ------- ----" ubuntu- advantage/ esm_cache. py" || true ------- ------- ------- ------- ------- --"
echo "** Verify no yaml breaks esm-cache service"
lxc exec $name -- sh -c ". ./env/bin/activate && python /usr/lib/
lxc exec $name -- systemctl start esm-cache.service
lxc exec $name -- systemctl status esm-cache.service || true
echo "------
upgrade_to_proposed
echo -e "\n---- ------- ------- ------- ------- ------- ----" ubuntu- advantage/ esm_cache. py" || true ------- ------- ------- ------- ------- --"
echo "** Verify python3 config no longer breaks esm-cache service"
lxc exec $name -- sh -c ". ./env/bin/activate && python /usr/lib/
lxc exec $name -- systemctl start esm-cache.service
lxc exec $name -- systemctl status esm-cache.service || true
echo "------
cleanup
------- ------- ------- -----