canonical / ubuntu-pro-client

Ubuntu Pro Client for offerings from Canonical
https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/
GNU General Public License v3.0
52 stars 73 forks source link

Bug: Pro client will not honor the disable_auto_attach cloud-init directive on GCP/Azure Pro images #3036

Open lucasmoura opened 5 months ago

lucasmoura commented 5 months ago

Description of the bug

One available config entry in the Pro module in cloud-init is the disable_auto_attach directive, for example:

ubuntu_pro:
  features:
    disable_auto_attach: True

This means that cloud-init will not attempt to run the auto-attach operation and neither the ua-auto-attach service.

However, on GCP/Azure, we have the ubuntu-advantage.service that keeps polling for a Pro license to auto-attach on GCP/Azure. Since a Pro image already have a valid license, the daemon will auto-attach on those images, regardless of that cloud-init userdata directive.

Expected behavior

That cloud-init directive should be respected by the Pro client.

It seems that we can change the daemon to use the full_auto_attach API, which already respects that configuration logic introduced by cloud-init.

Current behavior

The Pro image will boot attached, even if the disable_auto_attach directive is being set.

To Reproduce

Please include details on how to reproduce the bug.

  1. Launch a GCP/Azure image with the following userdata:
ubuntu_pro:
  features:
    disable_auto_attach: True
  1. Check that after boot, the machine ends up attached

System information:

This should only affect GCP/Azure Pro cloud images

renanrodrigo commented 2 weeks ago

We have code implemented to try to make this work, so we should either fix the behaviour or remove the code and follow on.