Merge pull request #1311 from ogayot/pro-services-auto-enabled

ubuntu-pro: add auto_enabled property for services
This commit is contained in:
Olivier Gayot 2022-06-13 17:45:17 +02:00 committed by GitHub
commit 7f4a72a12f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

View File

@ -460,6 +460,7 @@ class UbuntuProCheckTokenStatus(enum.Enum):
class UbuntuProService: class UbuntuProService:
name: str name: str
description: str description: str
auto_enabled: bool
@attr.s(auto_attribs=True) @attr.s(auto_attribs=True)

View File

@ -191,18 +191,22 @@ class TestUAInterface(unittest.TestCase):
self.assertIn(UbuntuProService( self.assertIn(UbuntuProService(
name="esm-infra", name="esm-infra",
description="UA Infra: Extended Security Maintenance (ESM)", description="UA Infra: Extended Security Maintenance (ESM)",
auto_enabled=True,
), services) ), services)
self.assertIn(UbuntuProService( self.assertIn(UbuntuProService(
name="fips", name="fips",
description="NIST-certified core packages", description="NIST-certified core packages",
auto_enabled=False,
), services) ), services)
self.assertNotIn(UbuntuProService( self.assertNotIn(UbuntuProService(
name="esm-apps", name="esm-apps",
description="UA Apps: Extended Security Maintenance (ESM)", description="UA Apps: Extended Security Maintenance (ESM)",
auto_enabled=True,
), services) ), services)
self.assertNotIn(UbuntuProService( self.assertNotIn(UbuntuProService(
name="cis", name="cis",
description="Center for Internet Security Audit Tools", description="Center for Internet Security Audit Tools",
auto_enabled=False,
), services) ), services)
# Test with "Z" suffix for the expiration date. # Test with "Z" suffix for the expiration date.

View File

@ -174,6 +174,7 @@ class UAInterface:
return UbuntuProService( return UbuntuProService(
name=service["name"], name=service["name"],
description=service["description"], description=service["description"],
auto_enabled=service["auto_enabled"] == "yes",
) )
activable_services: List[UbuntuProService] = [] activable_services: List[UbuntuProService] = []