** Description changed:

  [Impact]
  This is a major rewrite of ubuntu-advantage-client. This version introduces 
an updated command line interface (UA Client) to simplify some interaction with 
Ubuntu Advantage support offerings, and interacts with a new service backend 
built specifically for this new streamlined experience.
  
  Disco, Eoan, and Focal already have this rewrite (but an older version
  of it), but trusty, xenial, bionic and cosmic do not. This update is for
  trusty only at the moment, because the other LTSs and later releases
  have other services available under the UA umbrella which haven't yet
  been fully converted to the new backend.
  
  [Test Case]
  There are free services available for Trusty and anyone with an ubuntu one 
account can try them out with the new client.
  
  In order to attach a machine to UA, first obtain a token at
  https://auth.contracts.canonical.com/. With that token, attach the
  machine with this command:
  
  sudo ua attach <token>
  
  If that's successful, you will have ESM-infra enabled at the end.
  
  Additional test cases to confirm that the package correctly handles
  upgrades for all relevant cases:
  
  2. Trusty -proposed upgrade tests (TODO: run test-2a.sh and attach logs)
  #  2a. Start with a fresh Ubuntu instance which does not have u-a-t installed 
(i.e. ubuntu-minimal is not installed).  Install u-a-t from -updates. Do not 
enable ua. Upgrade to u-a-t from -proposed.
  
  echo --- BEGIN test 2a: upgrade unattached trusty-updates -> trusty-proposed
  # Make a minimal trusty chroot
  mk-sbuild trusty
  # Add the following placeholder for bind mounts in your 
/etc/schroot/sbuild/fstab:
  
  # SRUDATADIR
  
  # Add a shared data directory into the chroot/fstab
  mkdir -b 2a/var/lib/
  sudo sed -i 's/.*SRUDATADIR/\/home\/csmith\/2a     \/data   none    rw,bind   
      0       0  # SRUDATADIR" /etc/schroot/sbuild/fstab
  
  # connect to chroot and install on a system that lacks ubuntu-advantage-tools
  CHROOT_DIR=`schroot --config  -c trusty-amd64  | awk -F "=" 
'/^directory=/{print $2}'`
  
  # Install ua-tools from a given pocket name
  cat > ua_tools_install_from_pocket.sh  <<EOF
  #/bin/bash
  pocket_name=\$1
  mirror=http://archive.ubuntu.com/ubuntu
  echo deb \$mirror \$pocket_name main | tee 
/etc/apt/sources.list.d/\$pocket_name.list
  apt-get update -q;
  apt-get install -qy ubuntu-advantage-tools;
  echo \$?
  EOF
  sudo cp ua_tools_install_from_pocket.sh $CHROOT_DIR
  
  schroot -u root -c trusty-amd64 --directory /
  
  echo "test: No ubuntu-minimal or ubuntu-advantage-tools found"
  dpkg -l | egrep 'ubuntu-advantage|ubuntu-minimal'
  
  # Install ua-tools from trusty-updates
  bash /ua_tools_install_from_pocket.sh trusty-updates
  
  # Install ua-tools from trusty-proposed
  bash /ua_tools_install_from_pocket.sh trusty-proposed
  
  dpkg -l > /data/dpkg.list
  cp -r /etc/ /data
  cp -r /var/lib/ubuntu-advantage/* /data/var/lib/ubuntu-advantage
  exit
  
  # 2b. In an identical instance, install u-a-t directly from -proposed.
  echo --- BEGIN test 2b: install clean unattached trusty-proposed
  # connect to chroot and install on a system that lacks ubuntu-advantage-tools
  schroot -u root -c trusty-amd64 --directory /
  
  # Add a shared data directory into the chroot/fstab
  mkdir -b 2a/var/lib/
  sudo sed -i 's/.*SRUDATADIR/\/home\/csmith\/2a     \/data   none    rw,bind   
      0       0  # SRUDATADIR" /etc/schroot/sbuild/fstab
  
  # connect to chroot and install on a system that lacks ubuntu-advantage-
  tools
  
  schroot -u root -c trusty-amd64 --directory /
  
  echo "test: No ubuntu-minimal or ubuntu-advantage-tools found"
  dpkg -l | egrep 'ubuntu-advantage|ubuntu-minimal'
  
  # Install ua-tools from trusty-proposed
  bash /ua_tools_install_from_pocket.sh trusty-proposed
  
  dpkg -l > /data/dpkg.list
  cp -r /etc/ /data
  cp -r /var/lib/ubuntu-advantage/* /data/var/lib/ubuntu-advantage
  exit
  
  # 2c. Confirm that the on-disk results of a) and b) are identical.
  echo --- BEGIN test 2c: ensure no filesystem diffs betwenn 2a and 2b
  diff -urN 2a 2b
  
- 
  3. (TODO run test-3.sh script and attach log results)
-  a. Start with a fresh Ubuntu instance which does not have u-a-t installed 
(i.e. ubuntu-minimal is not installed).  Install u-a-t from -updates. Enable 
esm with 'ubuntu-advantage enable-esm'.  Upgrade to u-a-t from -proposed.=
+  a. Start with a fresh Ubuntu instance which does not have u-a-t installed 
(i.e. ubuntu-minimal is not installed).  Install u-a-t from -updates. Enable 
esm with 'ubuntu-advantage enable-esm'.  Upgrade to u-a-t from -proposed.=
  echo --- BEGIN test 3a: Install u-a-t from -updates and enable ESM, upgrade 
to -proposed
  # Use existing schroot from 2a or `mk-sbuild trusty`
  
  # Add a shared data directory into the chroot/fstab
  mkdir -b 3a/var/lib/
  sudo sed -i 's/.*SRUDATADIR/\/home\/csmith\/3a     \/data   none    rw,bind   
      0       0  # SRUDATADIR" /etc/schroot/sbuild/fstab
  
  # connect to minimal trusty schroot
- schroot -u root -c trusty-amd64 --directory / 
+ schroot -u root -c trusty-amd64 --directory /
  
  # Install ua-tools from trusty-updates
  bash /ua_tools_install_from_pocket.sh trusty-updates
  
  sudo ubuntu-advantage enable-esm <LEGACY_TOKEN>
  
  echo "Confirm ansible is available for esm PPA"
  apt-cache policy ansible
  
  # Install ua-tools from trusty-proposed
  bash /ua_tools_install_from_pocket.sh trusty-proposed
  
  echo "Confirm ansible is available for esm PPA"
  apt-cache policy ansible
  
  dpkg -l > /data/dpkg.list
  cp -r /etc/ /data
  cp -r /var/lib/ubuntu-advantage/* /data/var/lib/ubuntu-advantage
  exit
- 
  
  # 3b. In an identical instance, install u-a-t directly from -proposed and 
enable esm via auto-attach
  echo --- BEGIN test 3b: install clean u-a-t from trusty-proposed and `ua 
attach <TOKEN>` to enable esm
  # Use existing schroot from 2a or `mk-sbuild trusty`
  
  # Add a shared data directory into the chroot/fstab
  mkdir -b 3b/var/lib/
  sudo sed -i 's/.*SRUDATADIR/\/home\/csmith\/3b     \/data   none    rw,bind   
      0       0  # SRUDATADIR" /etc/schroot/sbuild/fstab
  
  # connect to chroot and install on a system that lacks ubuntu-advantage-
  tools
  
  schroot -u root -c trusty-amd64 --directory /
  
  echo "test: No ubuntu-minimal or ubuntu-advantage-tools found"
  dpkg -l | egrep 'ubuntu-advantage|ubuntu-minimal'
  
  # Install ua-tools from trusty-proposed
  bash /ua_tools_install_from_pocket.sh trusty-proposed
  
  ua attach <CONTRACT_TOKEN>
  ua status
  
  dpkg -l > /data/dpkg.list
  cp -r /etc/ /data
  cp -r /var/lib/ubuntu-advantage/* /data/var/lib/ubuntu-advantage
  exit
  
  # 3c. Confirm that the on-disk results of 3a) and 3b) are identical with 
exception of token
  echo --- BEGIN test 3c: ensure no filesystem diffs betwenn 3a and 3b with 
exception of token used
  diff -urN 3a 3b
  
  
- 4.
-  a. Start with a fresh Ubuntu instance which does have u-a-t installed.  
Enable esm with 'ubuntu-advantage enable-esm'.  Upgrade to u-a-t from -proposed.
-  b. In an identical instance, upgrade to u-a-t from -proposed.  Enable esm 
with 'ubuntu-advantage attach'.
-  c. Confirm that the on-disk results of a) and b) are identical.
+ 4. (TODO run test-4.sh script and attach log results)
+  a. Start with a fresh Ubuntu instance which does have u-a-t installed.  
Enable esm with 'ubuntu-advantage enable-esm'.  Upgrade to u-a-t from -proposed.
+ echo -- BEGIN test 4a: enable esm via `ubuntu-advantage enable-esm` on 
typical trusty-updates cloud-images which laready have -updates installed
+ lxc launch ubuntu-daily:trusty sru-trusty
+ 
+ mkdir -p 4a/var/lib/
+ 
+ echo "Confirm u-a-t is already installed"
+ lxc exec sru-trusty -- apt-cache policy ubuntu-advantage-tools
+ 
+ # emit script to upgrade u-a-t
+ cat > ua_tools_install_from_pocket.sh  <<EOF
+ #/bin/bash
+ pocket_name=\$1
+ mirror=http://archive.ubuntu.com/ubuntu
+ echo deb \$mirror \$pocket_name main | tee 
/etc/apt/sources.list.d/\$pocket_name.list
+ apt-get update -q;
+ apt-get install -qy ubuntu-advantage-tools;
+ echo \$?
+ EOF
+ 
+ echo "Enable esm via ubuntu-advantage enable-esm"
+ lxc exec sru-trusty -- ubuntu-advantage enable-esm <legacyToken>
+ 
+ echo "Confirm ansible is available for esm PPA"
+ apt-cache policy ansible
+ 
+ echo "Upgrade u-a-t to trusty-proposed"
+ lxc file push ua_tools_install_from_pocket.sh sru-trusty/
+ lxc exec sru-trusty "bash /ua_tools_install_from_pocket.sh trusty-proposed"
+ 
+ echo "Confirm ansible is available for esm PPA"
+ apt-cache policy ansible
+ 
+ lxc exec sru-trusty -- dpkg -l > 4a/dpkg.list
+ lxc file pull -r sru-trusty/etc 4a/
+ lxc file pull -r sru-trusty/var/lib/ubuntu-advantage 4a/var/lib
+ lxc stop sru-trusty
+ lxc delete sru-trusty
+ 
+  b. In an identical instance, upgrade to u-a-t from -proposed.  Enable
+ esm with 'ubuntu-advantage attach'.
+ 
+ echo -- BEGIN test 4b: upgrade u-a-t to -proposed version on typical 
trusty-updates cloud-images which laready have -updates installed
+ mkdir -p 4b/var/lib/
+ lxc launch ubuntu-daily:trusty sru-trusty
+ 
+ echo "Confirm u-a-t is already installed"
+ lxc exec sru-trusty -- apt-cache policy ubuntu-advantage-tools
+ 
+ echo "Upgrade u-a-t to trusty-proposed"
+ lxc file push ua_tools_install_from_pocket.sh sru-trusty/
+ lxc exec sru-trusty "bash /ua_tools_install_from_pocket.sh trusty-proposed"
+ 
+ echo "Enable esm via `ua attach <contractToken>`
+ 
+ lxc exec sru-trusty ua attach <contractToken>
+ 
+ echo "Confirm ansible is available for esm PPA"
+ apt-cache policy ansible
+ 
+ lxc exec sru-trusty -- dpkg -l > 4b/dpkg.list
+ lxc file pull -r sru-trusty/etc 4b/
+ lxc file pull -r sru-trusty/var/lib/ubuntu-advantage 4b/var/lib
+ lxc stop sru-trusty
+ lxc delete sru-trusty
+ 
+  4c. Confirm that the on-disk results of a) and b) are identical other than 
legacyToken|contractToken
+ echo --- BEGIN test 4c: ensure no filesystem diffs betwenn 4a and 4b with 
exception of token used
+ diff -urN 4a 4b
+ 
  5.
   a. Start with a fresh Ubuntu *precise* instance which does have u-a-t 
installed and esm enabled.  Dist-upgrade to trusty, then upgrade to u-a-t from 
-proposed.
   b. In an identical instance, dist-upgrade to trusty with -proposed enabled.
   c. Confirm that the on-disk results of a) and b) are identical.
  
  [Regression Potential]
  This is a major rewrite from bash to python3 and there are changes in 
behavior.
  - new services will be listed, but not avaialble for trusty, only for later 
LTSs
  - even when ESM is not enabled, an apt hook will advertise the availability 
of updates in that repository. This hook has failed in the past while this 
package was in disco, and that failed the apt transaction. This has of course 
been fixed since then (see #1824523 and #1824523).
  
  [Other Info]
  This is the FFe bug that got this rewrite into Disco at that time:
  https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1814157
  
  Development of this client is happening on github:
  https://github.com/CanonicalLtd/ubuntu-advantage-client
  
  Recently esm was renamed to esm-infra. Upgrading from an older package
  where it was just "esm" is handled in postinst.
  
  The ESM-infra GPG key can be verified by checking the signed release
  file over https:
  
  ESM: https://esm.ubuntu.com/ubuntu/dists/trusty-infra-updates/InRelease
  and https://esm.ubuntu.com/ubuntu/dists/trusty-infra-security/InRelease
  
  On an upgrade, existing users of trusty esm are expected to run "sudo ua
  attach [<token>]", although not doing it won't disable their existing
  ESM access. The new ua tool just won't recognize esm as being active in
  its "ua status" output until the attach operation is complete. The same
  applies to livepatch, if it was enabled before.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1832757

Title:
  Update ubuntu-advantage-client

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/1832757/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to