** 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
+ 
+ 2. Script reference 
https://gist.github.com/panlinux/4caaf069356da7436d97b47afce32234
+ 
+  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.
+  Do not enable ua. Upgrade to u-a-t from -proposed.
+  b. In an identical instance, install u-a-t from -proposed.
+  c. Confirm that the on-disk results of a) and b) are identical.
+ 
+ sudo su -
+ # adjust if needed, i.e., point to a mirror
+ export ARCHIVE_URL=http://br.archive.ubuntu.com/ubuntu
+ export PROPOSED_REPO="deb $ARCHIVE_URL trusty-proposed main"
+ 
+ mkdir /esm-sru
+ cd /esm-sru
+ truncate -s 10G file.img
+ zpool create -O sync=disabled tank $(pwd)/file.img
+ zfs create tank/trusty-minimal
+ debootstrap --exclude=ubuntu-minimal trusty /tank/trusty-minimal $ARCHIVE_URL
+ zfs snapshot tank/trusty-minimal@fresh
+ # confirm no ubuntu-minimal nor ubuntu-advantage-tools
+ chroot /tank/trusty-minimal dpkg -l | grep -E 
"(ubuntu-minimal|ubuntu-advantage)"
+ 
+ # create a clone from trusty-minimal called trusty-2a
+ zfs clone tank/trusty-minimal@fresh tank/trusty-2a
+ 
+ # add extra pockets
+ cat >> /tank/trusty-2a/etc/apt/sources.list <<EOF
+ deb $ARCHIVE_URL trusty-updates main
+ deb $ARCHIVE_URL trusty-security main
+ EOF
+ 
+ # install u-a-t from updates
+ chroot /tank/trusty-2a/ apt-get update
+ chroot /tank/trusty-2a/ apt-get install ubuntu-advantage-tools -y
+ 
+ # upgrade to u-a-t from proposed
+ cat > /tank/trusty-2a/etc/apt/sources.list.d/proposed.list <<EOF
+ $PROPOSED_REPO
+ EOF
+ chroot /tank/trusty-2a/ apt-get update
+ chroot /tank/trusty-2a/ apt-get install ubuntu-advantage-tools -y
+ 
+ # clone the first fresh snapshot and call it trusty-2b
+ zfs clone tank/trusty-minimal@fresh tank/trusty-2b
+ 
+ # install u-a-t directly from proposed
+ cat >> /tank/trusty-2b/etc/apt/sources.list <<EOF
+ deb $ARCHIVE_URL trusty-updates main
+ deb $ARCHIVE_URL trusty-security main
+ EOF
+ 
+ cat > /tank/trusty-2b/etc/apt/sources.list.d/proposed.list <<EOF
+ $PROPOSED_REPO
+ EOF
+ 
+ chroot /tank/trusty-2b/ apt-get update
+ chroot /tank/trusty-2b/ apt-get install ubuntu-advantage-tools -y
+ 
+ # get files from both datasets, stripping the zfs prefix
+ find /tank/trusty-2a/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-2a.list
+ find /tank/trusty-2b/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-2b.list
+ 
+ 
+ 3. Script reference 
https://gist.github.com/panlinux/4843bfc1e726a3f006aa44190411d582
+  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.
+  b. In an identical instance, install u-a-t from -proposed. Enable esm with 
'ubuntu-advantage attach'.
+  c. Confirm that the on-disk results of a) and b) are identical.
+ 
+ sudo su -
+ # adjust if needed, i.e., point to a mirror
+ export ARCHIVE_URL=http://br.archive.ubuntu.com/ubuntu
+ export PROPOSED_REPO="deb $ARCHIVE_URL trusty-proposed main"
+ 
+ # these are needed
+ export LEGACY_ESM_TOKEN="user:password"
+ export UA_CONTRACT_TOKEN="<token>"
+ 
+ mkdir /esm-sru
+ cd /esm-sru
+ truncate -s 10G file.img
+ zpool create -O sync=disabled tank $(pwd)/file.img
+ zfs create tank/trusty-minimal
+ debootstrap --exclude=ubuntu-minimal trusty /tank/trusty-minimal $ARCHIVE_URL
+ zfs snapshot tank/trusty-minimal@fresh
+ # confirm no ubuntu-minimal nor ubuntu-advantage-tools
+ chroot /tank/trusty-minimal dpkg -l | grep -E 
"(ubuntu-minimal|ubuntu-advantage)"
+ 
+ # create a clone from trusty-minimal called trusty-3a
+ zfs clone tank/trusty-minimal@fresh tank/trusty-3a
+ 
+ # add extra pockets
+ cat >> /tank/trusty-3a/etc/apt/sources.list <<EOF
+ deb $ARCHIVE_URL trusty-updates main
+ deb $ARCHIVE_URL trusty-security main
+ EOF
+ 
+ # install u-a-t from updates
+ chroot /tank/trusty-3a/ apt-get update
+ chroot /tank/trusty-3a/ apt-get install ubuntu-advantage-tools -y
+ 
+ # enable esm
+ chroot /tank/trusty-3a/ ubuntu-advantage enable-esm "$LEGACY_ESM_TOKEN"
+ 
+ # upgrade to u-a-t from proposed
+ cat > /tank/trusty-3a/etc/apt/sources.list.d/proposed.list <<EOF
+ $PROPOSED_REPO
+ EOF
+ chroot /tank/trusty-3a/ apt-get update
+ chroot /tank/trusty-3a/ apt-get install ubuntu-advantage-tools -y
+ 
+ # clone the first fresh snapshot and call it trusyt-3b
+ zfs clone tank/trusty-minimal@fresh tank/trusty-3b
+ 
+ # install u-a-t directly from proposed
+ cat >> /tank/trusty-3b/etc/apt/sources.list <<EOF
+ deb $ARCHIVE_URL trusty-updates main
+ deb $ARCHIVE_URL trusty-security main
+ EOF
+ 
+ cat > /tank/trusty-3b/etc/apt/sources.list.d/proposed.list <<EOF
+ $PROPOSED_REPO
+ EOF
+ 
+ chroot /tank/trusty-3b/ apt-get update
+ chroot /tank/trusty-3b/ apt-get install ubuntu-advantage-tools -y
+ 
+ # with the new u-a-t from proposed, run attach, which also enables esm
+ chroot /tank/trusty-3b/ ua attach $UA_CONTRACT_TOKEN
+ 
+ # get files from both datasets, stripping the zfs prefix
+ find /tank/trusty-3a/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-3a.list
+ find /tank/trusty-3b/ | sed -r 's,^/tank/[^/]+,,' | sort > trusty-3b.list
+ 
+ 
+ 4.Script reference
+ https://gist.github.com/blackboxsw/0e968aeabd42c23df619d29c7906c76e
+ 
+  4a. 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.
+  4b. In an identical instance, upgrade to u-a-t from -proposed. Enable esm 
with 'ubuntu-advantage attach'.
+  4c. Confirm that the on-disk results of a) and b) are identical other than 
legacyToken|contractToken
+ 
+ export LEGACY_ESM_TOKEN=<ppauser:password>
+ export UA_CONTRACT_TOKEN=<NewContractToken>
+ export ARCHIVE_URL=http://archive.ubuntu.com/ubuntu
+ 
+ echo -- BEGIN test 4a: enable esm via `ubuntu-advantage enable-esm` on
+ typical trusty-updates cloud-images which already have -updates
+ installed
+ 
+ # Launch a basic trusty cloud-image that is updated to latest 
ubuntu-advantage-tools from -updates
+ cat > update-uat-trusty.yaml <<EOF
+ #cloud-config
+ package_update: true
+ package_upgrade: true
+ runcmd:
+  - apt-get install -qy ubuntu-advantage-tools 
+ EOF
+ 
+ lxc launch ubuntu-daily:trusty esm-sru-4a -c user.user-data="$(cat
+ update-uat-trusty.yaml)"
+ 
+ echo "Wait for cloud-init to finish startup on trusty"
+ RUNLEVEL="NOTSET"
+ while ! [ "N 2" = "$RUNLEVEL" ]; do echo -n '.'; sleep 1; RUNLEVEL=`lxc exec 
esm-sru-4a runlevel`; done; echo
+ mkdir /esm-sru
+ cd /esm-sru
+ mkdir 4a 4b
+ 
+ echo "Confirm u-a-t is already installed"
+ lxc exec esm-sru-4a -- apt-cache policy ubuntu-advantage-tools
+ 
+ cat > ppa-key << EOF
+ -----BEGIN PGP PUBLIC KEY BLOCK-----
+ 
+ xo0EUs00cgEEAJJqaPue5gzQiLB1krT9slYbqVW/bSBpW9+qX8gFI44IVM/Bo3yh
+ 9BPAs1RAzja96N0FS6SNlew4JYfk7MBT2sFDGpm3bTKt9Go7muO0JkvKv0vYgrrw
+ qORlWK3SfsYa6EpsCdVzZPAKvGzc8I0XywVgcJhM5okx+3J2naBaSp9NABEBAAHN
+ K0xhdW5jaHBhZCBQUEEgZm9yIENJIFRyYWluIFBQQSBTZXJ2aWNlIFRlYW3CuAQT
+ AQIAIgUCUs00cgIbAwYLCQgHAwIGFQgCCQoLBBYCAwECHgECF4AACgkQhVBBKOzx
+ IEy62gP/T2h98ongV+RXekM1DpgTNoH0PBHrZVj4zfrvrYKZOaxRmJ6TWtzG8tFI
+ uB4gPjaFeenJBhCFaZ9UncFQemS9jztQ/pA049L1N7Tijd8/BKD7gc7tM07+Fq+Q
+ 6DT7VuUFiVlfZUwWYzk5UXEk6ctluoIRpnRWUHmh6NssuAgd1Nk=
+ =aPbC
+ -----END PGP PUBLIC KEY BLOCK-----
+ EOF
+ 
+ # emit script to upgrade u-a-t
+ cat > add_uat_apt_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.=
- 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 /
- 
- # Install ua-tools from trusty-updates
- bash /ua_tools_install_from_pocket.sh trusty-updates
- 
- sudo ubuntu-advantage enable-esm <LEGACY_TOKEN>
+ if [ "\$pocket_name" = "devel" ]; then
+   echo deb [trusted=yes] 
http://ppa.launchpad.net/ci-train-ppa-service/3830/ubuntu trusty main | tee 
/etc/apt/sources.list.d/\$pocket_name.list
+   apt-key add /ppa-key
+ else
+   echo deb $ARCHIVE_URL \$pocket_name main | tee 
/etc/apt/sources.list.d/\$pocket_name.list
+ fi
+ EOF
+ 
+ lxc file push ppa-key esm-sru-4a/
+ lxc file push add_uat_apt_pocket.sh esm-sru-4a/
+ lxc exec esm-sru-4a chmod 755 /add_uat_apt_pocket.sh
+ 
+ echo "Make a pristine lxc snapshot for 4a and 4b"
+ lxc snapshot esm-sru-4a esm-sru-4a-pristine
+ 
+ echo "Enable esm via ubuntu-advantage enable-esm"
+ lxc exec esm-sru-4a -- ubuntu-advantage enable-esm $LEGACY_ESM_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
+ lxc exec esm-sru-4a apt-cache policy ansible
+ 
+ echo "Upgrade u-a-t to trusty-proposed"
+ lxc exec esm-sru-4a /add_uat_apt_pocket.sh trusty-proposed #   or devel
+ lxc exec esm-sru-4a -- apt-get update -q;
+ lxc exec esm-sru-4a -- apt-get install -qy ubuntu-advantage-tools;
  
  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. (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>
+ lxc exec esm-sru-4a apt-cache policy ansible
+ 
+ lxc exec esm-sru-4a -- find / -xdev | sort > 4a/files.list
+ lxc file pull -r esm-sru-4a/etc 4a/
+ 
+ 
+ echo -- BEGIN test 4b: upgrade u-a-t to -proposed version on typical 
trusty-updates cloud-images which already have -updates installed
+ lxc restore esm-sru-4a esm-sru-4a-pristine
+ 
+ echo "Confirm u-a-t is already installed from trusty-updates v. 
10ubuntu0.14.04.4"
+ lxc exec esm-sru-4a -- apt-cache policy ubuntu-advantage-tools
+ 
+ echo "Upgrade u-a-t to trusty-proposed"
+ lxc exec esm-sru-4a /add_uat_apt_pocket.sh trusty-proposed   # or devel
+ lxc exec esm-sru-4a -- apt-get update -q;
+ lxc exec esm-sru-4a -- apt-get install -qy ubuntu-advantage-tools;
+ 
+ echo "Enable esm via: ua attach <contractToken>"
+ lxc exec esm-sru-4a ua attach $UA_CONTRACT_TOKEN
  
  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
+ lxc exec esm-sru-4a apt-cache policy ansible
+ 
+ lxc exec esm-sru-4a -- find / -xdev | sort > 4b/files.list
+ lxc file pull -r esm-sru-4a/etc 4b/
+ 
+ echo --- BEGIN test 4c: ensure no filesystem diffs between 4a and 4b with 
exception of token used
  diff -urN 4a 4b
  
- 5. (TODO run test-5.sh and attach logs to bug)
-  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.
+ 
+ 5. Script reference 
https://gist.github.com/panlinux/e5bda289401660d77ed5eff4d980c30c
+ 
+  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.
  echo --- BEGIN test 5a: dist-upgrade an esm-enable precise-updates to 
trusty-updates, then upgrade to -proposed
  
  mkdir -p 5a/var/lib/
  echo "Launch precise container with allowing ssh access for <LP_ID>"
  
  cat >precise.yaml <<EOF
  #cloud-config
  ssh_import_id: [<LP_ID>]
  EOF
  lxc launch ubuntu-daily:precise sru-precise -c user.user-data="$(cat 
precise.yaml)"
- 
  
  echo "Enable esm on precise"
  lxc exec sru-precise ubuntu-advantage enable-esm <legacyToken>
  
  echo "Dist-upgrade precise -> trusty"
  VM_IP=`lxc list dev-p -c 4 | awk '/10/{print $2}'`
  ssh ubuntu@$VM_IP
  sudo mkdir -p /etc/update-manager/release-upgrades.d
  echo -e "[Sources]\nAllowThirdParty=yes" > allow.cfg
  sudo mv allow.cfg /etc/update-manager/release-upgrades.d
  sudo do-release-upgrade   # respond yes to any interactive prompts
  
- 
  echo "Confirm ansible is available for trusty esm PPA"
  apt-cache policy ansible
  
  echo "Upgrade u-a-t to trusty-proposed"
  lxc file push ua_tools_install_from_pocket.sh sru-precise/
  lxc exec sru-precise "bash /ua_tools_install_from_pocket.sh trusty-proposed"
  
  lxc exec sru-precise -- dpkg -l > 5a/dpkg.list
  lxc file pull -r sru-precise/etc 5a/
  lxc file pull -r sru-precise/var/lib/ubuntu-advantage 5a/var/lib
  lxc stop sru-precise
  lxc delete sru-precise
  
-  b. In an identical instance, dist-upgrade to trusty with -proposed enabled.
+  b. In an identical instance, dist-upgrade to trusty with -proposed enabled.
  echo --- BEGIN test 5b: dist-upgrade an esm-enable precise-proposed to 
trusty-proposed
  mkdir -p 5b/var/lib/
  echo "Launch precise container with allowing ssh access for <LP_ID>"
  
  cat >precise.yaml <<EOF
  #cloud-config
  ssh_import_id: [<LP_ID>]
  EOF
  lxc launch ubuntu-daily:precise sru-precise -c user.user-data="$(cat 
precise.yaml)"
- 
  
  echo "Enable esm on precise"
  lxc exec sru-precise ubuntu-advantage enable-esm <legacyToken>
  
  echo "Upgrade u-a-t to precise-proposed"   # no-op
  lxc file push ua_tools_install_from_pocket.sh sru-precise/
  lxc exec sru-precise "bash /ua_tools_install_from_pocket.sh sru-proposed"
  lxc exec sru-precise "apt-get dist-upgrade"
  
  echo "Dist-upgrade precise-proposed -> trusty-proposed"
  VM_IP=`lxc list dev-p -c 4 | awk '/10/{print $2}'`
  ssh ubuntu@$VM_IP
  sudo mkdir -p /etc/update-manager/release-upgrades.d
  echo -e "[Sources]\nAllowThirdParty=yes" > allow.cfg
  sudo mv allow.cfg /etc/update-manager/release-upgrades.d
  sudo do-release-upgrade   # respond yes to any interactive prompts
  
- 
  echo "Confirm ansible is available for trusty esm PPA"
  apt-cache policy ansible
  
  lxc exec sru-precise -- dpkg -l > 5b/dpkg.list
  lxc file pull -r sru-precise/etc 5b/
  lxc file pull -r sru-precise/var/lib/ubuntu-advantage 5b/var/lib
  lxc stop sru-precise
  lxc delete sru-precise
  
- 
-  c. Confirm that the on-disk results of a) and b) are identical.
+  c. Confirm that the on-disk results of a) and b) are identical.
  echo --- BEGIN test 5c: confirm filesytem changes of test 5a and 5b are 
identical
  dirr -urN 5a 5b
- 
  
  [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