Merge ~lamoura/ubuntu/+source/ubuntu-advantage-tools:upload-29.1-mantic into ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel

Proposed by Lucas Albuquerque Medeiros de Moura
Status: Merged
Merged at revision: 68ae060f416186f0b82edc22a12693a40c1a1668
Proposed branch: ~lamoura/ubuntu/+source/ubuntu-advantage-tools:upload-29.1-mantic
Merge into: ubuntu/+source/ubuntu-advantage-tools:ubuntu/devel
Diff against target: 195 lines (+71/-17)
7 files modified
debian/changelog (+6/-0)
features/anbox.feature (+32/-2)
features/attached_status.feature (+2/-1)
uaclient/entitlements/anbox.py (+22/-13)
uaclient/entitlements/entitlement_status.py (+1/-0)
uaclient/messages.py (+7/-0)
uaclient/version.py (+1/-1)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior (community) Approve
Canonical Server Reporter Pending
Review via email: mp+448939@code.launchpad.net

Description of the change

Add feature that allows the Anbox service to be enabled on a container.
This is the only feature that is being added on top of release 29

To post a comment you must log in.
Revision history for this message
Lucas Albuquerque Medeiros de Moura (lamoura) wrote :
Download full text (15.4 KiB)

Mantic:
  - Source ubuntu-advantage-tools/29.1~rc1: Published
    + amd64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=amd64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging♻️
    + arm64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=arm64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging♻️
    + armhf: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=armhf&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging♻️
    + ppcel64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=ppcel64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging♻️
    + riscv64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=riscv64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging♻️
    + s390x: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=s390x&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging♻️
    + amd64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=amd64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging💍
    + arm64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=arm64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging💍
    + armhf: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=armhf&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging💍
    + ppcel64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=ppcel64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging💍
    + riscv64: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=riscv64&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging💍
    + s390x: https://autopkgtest.ubuntu.com/request.cgi?release=mantic&package=ubuntu-advantage-tools&arch=s390x&trigger=ubuntu-advantage-tools%2F29.1~rc1&ppa=ua-client%2Fstaging💍

Lunar:
  - Source ubuntu-advantage-tools/29.1~23.04~rc1: Published
    + amd64: https://autopkgtest.ubuntu.com/request.cgi?release=lunar&package=ubuntu-advantage-tools&arch=amd64&trigger=ubuntu-advantage-tools%2F29.1~23.04~rc1&ppa=ua-client%2Fstaging♻️
    + arm64: https://autopkgtest.ubuntu.com/request.cgi?release=lunar&package=ubuntu-advantage-tools&arch=arm64&trigger=ubuntu-advantage-tools%2F29.1~23.04~rc1&ppa=ua-client%2Fstaging♻️
    + armhf: https://autopkgtest.ubuntu.com/request.cgi?release=lunar&package=ubunt...

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks, Lucas.

dep8 results look fine.

Everything else LGTM; the changes are simple and don't affect the Debian packaging.

Uploaded:

$ dput ubuntu-advantage-tools_29.1_source.changes
Trying to upload package to ubuntu
Checking signature on .changes
gpg: /home/sergio/work/ubuntu-advantage-tools/ubuntu-advantage-tools_29.1_source.changes: Valid signature from 106DA1C8C3CBBF14
Checking signature on .dsc
gpg: /home/sergio/work/ubuntu-advantage-tools/ubuntu-advantage-tools_29.1.dsc: Valid signature from 106DA1C8C3CBBF14
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading ubuntu-advantage-tools_29.1.dsc: done.
  Uploading ubuntu-advantage-tools_29.1.tar.xz: done.
  Uploading ubuntu-advantage-tools_29.1_source.buildinfo: done.
  Uploading ubuntu-advantage-tools_29.1_source.changes: done.
Successfully uploaded packages.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index 26f78a9..6d7a651 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
1ubuntu-advantage-tools (29.1) mantic; urgency=medium
2
3 * anbox: allow enabling service on container using the --access-only flag
4
5 -- Lucas Moura <lucas.moura@canonical.com> Thu, 10 Aug 2023 11:08:46 -0300
6
1ubuntu-advantage-tools (29) mantic; urgency=medium7ubuntu-advantage-tools (29) mantic; urgency=medium
28
3 * d/control:9 * d/control:
diff --git a/features/anbox.feature b/features/anbox.feature
index 4f50faa..424b575 100644
--- a/features/anbox.feature
+++ b/features/anbox.feature
@@ -6,16 +6,46 @@ Feature: Enable anbox on Ubuntu
6 Scenario Outline: Enable Anbox cloud service in a container6 Scenario Outline: Enable Anbox cloud service in a container
7 Given a `<release>` machine with ubuntu-advantage-tools installed7 Given a `<release>` machine with ubuntu-advantage-tools installed
8 When I attach `contract_token` with sudo and options `--no-auto-enable`8 When I attach `contract_token` with sudo and options `--no-auto-enable`
9 When I run `pro status` as non-root
10 Then stdout matches regexp:
11 """
12 anbox-cloud +yes +disabled
13 """
9 Then I verify that running `pro enable anbox-cloud` `as non-root` exits `1`14 Then I verify that running `pro enable anbox-cloud` `as non-root` exits `1`
10 And I will see the following on stderr:15 And I will see the following on stderr:
11 """16 """
12 This command must be run as root (try using sudo).17 This command must be run as root (try using sudo).
13 """18 """
14 Then I verify that running `pro enable anbox-cloud` `with sudo` exits `1`19 When I verify that running `pro enable anbox-cloud` `with sudo` exits `1`
20 Then I will see the following on stdout:
21 """
22 One moment, checking your subscription first
23 It is only possible to enable Anbox Cloud on a container using
24 the --access-only flag.
25 """
26 When I run `pro enable anbox-cloud --access-only` with sudo
15 Then I will see the following on stdout:27 Then I will see the following on stdout:
16 """28 """
17 One moment, checking your subscription first29 One moment, checking your subscription first
18 Cannot install Anbox Cloud on a container.30 Updating package lists
31 Skipping installing packages
32 Anbox Cloud access enabled
33 """
34 When I run `pro status` as non-root
35 Then stdout matches regexp:
36 """
37 anbox-cloud +yes +enabled
38 """
39 When I run `apt-cache policy` with sudo
40 Then apt-cache policy for the following url has permission `500`
41 """
42 https://archive.anbox-cloud.io/stable <release>/main amd64 Packages
43 """
44 When I run `pro disable anbox-cloud` with sudo
45 And I run `pro status` as non-root
46 Then stdout matches regexp:
47 """
48 anbox-cloud +yes +disabled
19 """49 """
2050
21 Examples: ubuntu release51 Examples: ubuntu release
diff --git a/features/attached_status.feature b/features/attached_status.feature
index 682e229..b59f0bd 100644
--- a/features/attached_status.feature
+++ b/features/attached_status.feature
@@ -182,6 +182,7 @@ Feature: Attached status
182 Then stdout matches regexp:182 Then stdout matches regexp:
183 """183 """
184 SERVICE +ENTITLED +STATUS +DESCRIPTION184 SERVICE +ENTITLED +STATUS +DESCRIPTION
185 anbox-cloud +yes +disabled +.*
185 esm-apps +yes +enabled +Expanded Security Maintenance for Applications186 esm-apps +yes +enabled +Expanded Security Maintenance for Applications
186 esm-infra +yes +enabled +Expanded Security Maintenance for Infrastructure187 esm-infra +yes +enabled +Expanded Security Maintenance for Infrastructure
187 usg +yes +disabled +Security compliance and audit tools188 usg +yes +disabled +Security compliance and audit tools
@@ -194,7 +195,7 @@ Feature: Attached status
194 Then stdout matches regexp:195 Then stdout matches regexp:
195 """196 """
196 SERVICE +ENTITLED +STATUS +DESCRIPTION197 SERVICE +ENTITLED +STATUS +DESCRIPTION
197 anbox-cloud +yes +n/a +.*198 anbox-cloud +yes +disabled +.*
198 cc-eal +yes +n/a +Common Criteria EAL2 Provisioning Packages199 cc-eal +yes +n/a +Common Criteria EAL2 Provisioning Packages
199 esm-apps +yes +enabled +Expanded Security Maintenance for Applications200 esm-apps +yes +enabled +Expanded Security Maintenance for Applications
200 esm-infra +yes +enabled +Expanded Security Maintenance for Infrastructure201 esm-infra +yes +enabled +Expanded Security Maintenance for Infrastructure
diff --git a/uaclient/entitlements/anbox.py b/uaclient/entitlements/anbox.py
index 33e94ab..37a2b73 100644
--- a/uaclient/entitlements/anbox.py
+++ b/uaclient/entitlements/anbox.py
@@ -1,12 +1,16 @@
1from typing import Any, Dict, Optional, Tuple1from typing import Any, Dict, Optional, Tuple
22
3from uaclient import contract, event_logger, messages, system3from uaclient import contract, event_logger, messages, system
4from uaclient.entitlements.entitlement_status import (
5 CanEnableFailure,
6 CanEnableFailureReason,
7)
4from uaclient.entitlements.repo import RepoEntitlement8from uaclient.entitlements.repo import RepoEntitlement
5from uaclient.files.state_files import (9from uaclient.files.state_files import (
6 AnboxCloudData,10 AnboxCloudData,
7 anbox_cloud_credentials_file,11 anbox_cloud_credentials_file,
8)12)
9from uaclient.types import MessagingOperationsDict, StaticAffordance13from uaclient.types import MessagingOperationsDict
1014
11event = event_logger.get_event_logger()15event = event_logger.get_event_logger()
1216
@@ -22,24 +26,29 @@ class AnboxEntitlement(RepoEntitlement):
22 supports_access_only = True26 supports_access_only = True
2327
24 @property28 @property
25 def static_affordances(self) -> Tuple[StaticAffordance, ...]:
26 return (
27 (
28 messages.SERVICE_ERROR_INSTALL_ON_CONTAINER.format(
29 title=self.title
30 ),
31 lambda: system.is_container(),
32 False,
33 ),
34 )
35
36 @property
37 def messaging(self) -> MessagingOperationsDict:29 def messaging(self) -> MessagingOperationsDict:
38 if not self.access_only:30 if not self.access_only:
39 return {"post_enable": [messages.ANBOX_RUN_INIT_CMD.msg]}31 return {"post_enable": [messages.ANBOX_RUN_INIT_CMD.msg]}
40 else:32 else:
41 return {}33 return {}
4234
35 def can_enable(self) -> Tuple[bool, Optional[CanEnableFailure]]:
36 ret, reason = super().can_enable()
37
38 if not ret:
39 return ret, reason
40
41 if system.is_container() and not self.access_only:
42 return (
43 False,
44 CanEnableFailure(
45 CanEnableFailureReason.ONLY_ACCESS_ONLY_SUPPORTED,
46 messages.ANBOX_FAIL_TO_ENABLE_ON_CONTAINER,
47 ),
48 )
49
50 return True, None
51
43 def _perform_enable(self, silent: bool = False) -> bool:52 def _perform_enable(self, silent: bool = False) -> bool:
44 ret = super()._perform_enable(silent=silent)53 ret = super()._perform_enable(silent=silent)
4554
diff --git a/uaclient/entitlements/entitlement_status.py b/uaclient/entitlements/entitlement_status.py
index baa123f..af8bb5f 100644
--- a/uaclient/entitlements/entitlement_status.py
+++ b/uaclient/entitlements/entitlement_status.py
@@ -96,6 +96,7 @@ class CanEnableFailureReason(enum.Enum):
96 INCOMPATIBLE_SERVICE = object()96 INCOMPATIBLE_SERVICE = object()
97 INACTIVE_REQUIRED_SERVICES = object()97 INACTIVE_REQUIRED_SERVICES = object()
98 ACCESS_ONLY_NOT_SUPPORTED = object()98 ACCESS_ONLY_NOT_SUPPORTED = object()
99 ONLY_ACCESS_ONLY_SUPPORTED = object()
99100
100101
101class CanEnableFailure:102class CanEnableFailure:
diff --git a/uaclient/messages.py b/uaclient/messages.py
index 976c2a9..4fd06d8 100644
--- a/uaclient/messages.py
+++ b/uaclient/messages.py
@@ -1384,6 +1384,13 @@ For more information, see https://anbox-cloud.io/docs/tut/installing-appliance
1384""",1384""",
1385)1385)
13861386
1387ANBOX_FAIL_TO_ENABLE_ON_CONTAINER = NamedMessage(
1388 "anbox-fail-to-enable-on-container",
1389 """\
1390It is only possible to enable Anbox Cloud on a container using
1391the --access-only flag.""",
1392)
1393
1387INSTALLING_PACKAGES = "Installing {}"1394INSTALLING_PACKAGES = "Installing {}"
1388UNINSTALLING_PACKAGES = "Uninstalling {}"1395UNINSTALLING_PACKAGES = "Uninstalling {}"
1389UNINSTALLING_PACKAGES_FAILED = "Failure when uninstalling {}"1396UNINSTALLING_PACKAGES_FAILED = "Failure when uninstalling {}"
diff --git a/uaclient/version.py b/uaclient/version.py
index 9fdbc8d..b8e1f94 100644
--- a/uaclient/version.py
+++ b/uaclient/version.py
@@ -15,7 +15,7 @@ from uaclient.defaults import CANDIDATE_CACHE_PATH, UAC_RUN_PATH
15from uaclient.exceptions import ProcessExecutionError15from uaclient.exceptions import ProcessExecutionError
16from uaclient.system import subp16from uaclient.system import subp
1717
18__VERSION__ = "29"18__VERSION__ = "29.1"
19PACKAGED_VERSION = "@@PACKAGED_VERSION@@"19PACKAGED_VERSION = "@@PACKAGED_VERSION@@"
2020
21CANDIDATE_REGEX = r"Candidate: (?P<candidate>.*?)\n"21CANDIDATE_REGEX = r"Candidate: (?P<candidate>.*?)\n"

Subscribers

People subscribed via source and target branches

to status/vote changes: