Skip to content

Commit

Permalink
refactor: move help text into code
Browse files Browse the repository at this point in the history
  • Loading branch information
orndorffgrant committed Aug 18, 2023
1 parent 49cc486 commit c04c147
Show file tree
Hide file tree
Showing 17 changed files with 127 additions and 175 deletions.
1 change: 1 addition & 0 deletions debian/ubuntu-advantage-tools.maintscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ rm_conffile /etc/update-motd.d/80-livepatch 19.1~ ubuntu-advantage-tools
rm_conffile /etc/cron.daily/ubuntu-advantage-tools 19.1~ ubuntu-advantage-tools
rm_conffile /etc/init/ua-auto-attach.conf 20.2~ ubuntu-advantage-tools
rm_conffile /etc/update-motd.d/88-esm-announce 27.14~ ubuntu-advantage-tools
rm_conffile /etc/ubuntu-advantage/help_data.yaml 30~ ubuntu-advantage-tools
58 changes: 26 additions & 32 deletions features/attached_commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -455,17 +455,17 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
<infra-status>
Help:
Expanded Security Maintenance for Infrastructure provides access
to a private ppa which includes available high and critical CVE fixes
for Ubuntu LTS packages in the Ubuntu Main repository between the end
of the standard Ubuntu LTS security maintenance and its end of life.
It is enabled by default with Ubuntu Pro. You can find out more about
the service at https://ubuntu.com/security/esm
Expanded Security Maintenance for Infrastructure provides access to a private
PPA which includes available high and critical CVE fixes for Ubuntu LTS
packages in the Ubuntu Main repository between the end of the standard Ubuntu
LTS security maintenance and its end of life. It is enabled by default with
Ubuntu Pro. You can find out more about the service at
https://ubuntu.com/security/esm
"""
When I run `pro help esm-infra --format json` with sudo
Then I will see the following on stdout:
"""
{"name": "esm-infra", "entitled": "yes", "status": "<infra-status>", "help": "Expanded Security Maintenance for Infrastructure provides access\nto a private ppa which includes available high and critical CVE fixes\nfor Ubuntu LTS packages in the Ubuntu Main repository between the end\nof the standard Ubuntu LTS security maintenance and its end of life.\nIt is enabled by default with Ubuntu Pro. You can find out more about\nthe service at https://ubuntu.com/security/esm\n"}
{"name": "esm-infra", "entitled": "yes", "status": "<infra-status>", "help": "Expanded Security Maintenance for Infrastructure provides access to a private\nPPA which includes available high and critical CVE fixes for Ubuntu LTS\npackages in the Ubuntu Main repository between the end of the standard Ubuntu\nLTS security maintenance and its end of life. It is enabled by default with\nUbuntu Pro. You can find out more about the service at\nhttps://ubuntu.com/security/esm"}
"""
And I verify that running `pro help invalid-service` `with sudo` exits `1`
And I will see the following on stderr:
Expand All @@ -486,9 +486,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
- esm-infra: Expanded Security Maintenance for Infrastructure
\(https://ubuntu.com/security/esm\)
- fips-updates: NIST-certified core packages with priority security updates
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
\(https://ubuntu.com/security/fips\)
- fips: NIST-certified core packages \(https://ubuntu.com/security/fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
Expand All @@ -508,9 +507,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
- esm-infra: Expanded Security Maintenance for Infrastructure
\(https://ubuntu.com/security/esm\)
- fips-updates: NIST-certified core packages with priority security updates
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
\(https://ubuntu.com/security/fips\)
- fips: NIST-certified core packages \(https://ubuntu.com/security/fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
Expand All @@ -530,9 +528,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
- esm-infra: Expanded Security Maintenance for Infrastructure
\(https://ubuntu.com/security/esm\)
- fips-updates: NIST-certified core packages with priority security updates
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
\(https://ubuntu.com/security/fips\)
- fips: NIST-certified core packages \(https://ubuntu.com/security/fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
Expand Down Expand Up @@ -571,17 +568,17 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
enabled
Help:
Expanded Security Maintenance for Infrastructure provides access
to a private ppa which includes available high and critical CVE fixes
for Ubuntu LTS packages in the Ubuntu Main repository between the end
of the standard Ubuntu LTS security maintenance and its end of life.
It is enabled by default with Ubuntu Pro. You can find out more about
the service at https://ubuntu.com/security/esm
Expanded Security Maintenance for Infrastructure provides access to a private
PPA which includes available high and critical CVE fixes for Ubuntu LTS
packages in the Ubuntu Main repository between the end of the standard Ubuntu
LTS security maintenance and its end of life. It is enabled by default with
Ubuntu Pro. You can find out more about the service at
https://ubuntu.com/security/esm
"""
When I run `pro help esm-infra --format json` with sudo
Then I will see the following on stdout:
"""
{"name": "esm-infra", "entitled": "yes", "status": "enabled", "help": "Expanded Security Maintenance for Infrastructure provides access\nto a private ppa which includes available high and critical CVE fixes\nfor Ubuntu LTS packages in the Ubuntu Main repository between the end\nof the standard Ubuntu LTS security maintenance and its end of life.\nIt is enabled by default with Ubuntu Pro. You can find out more about\nthe service at https://ubuntu.com/security/esm\n"}
{"name": "esm-infra", "entitled": "yes", "status": "enabled", "help": "Expanded Security Maintenance for Infrastructure provides access to a private\nPPA which includes available high and critical CVE fixes for Ubuntu LTS\npackages in the Ubuntu Main repository between the end of the standard Ubuntu\nLTS security maintenance and its end of life. It is enabled by default with\nUbuntu Pro. You can find out more about the service at\nhttps://ubuntu.com/security/esm"}
"""
And I verify that running `pro help invalid-service` `with sudo` exits `1`
And I will see the following on stderr:
Expand All @@ -600,9 +597,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
- esm-infra: Expanded Security Maintenance for Infrastructure
\(https://ubuntu.com/security/esm\)
- fips-updates: NIST-certified core packages with priority security updates
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
\(https://ubuntu.com/security/fips\)
- fips: NIST-certified core packages \(https://ubuntu.com/security/fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
Expand All @@ -628,9 +624,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
- esm-infra: Expanded Security Maintenance for Infrastructure
\(https://ubuntu.com/security/esm\)
- fips-updates: NIST-certified core packages with priority security updates
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
\(https://ubuntu.com/security/fips\)
- fips: NIST-certified core packages \(https://ubuntu.com/security/fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
Expand All @@ -656,9 +651,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
- esm-infra: Expanded Security Maintenance for Infrastructure
\(https://ubuntu.com/security/esm\)
- fips-updates: NIST-certified core packages with priority security updates
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
\(https://ubuntu.com/security/fips\)
- fips: NIST-certified core packages \(https://ubuntu.com/security/fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
Expand Down
14 changes: 7 additions & 7 deletions features/unattached_commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@ Feature: Command behaviour when unattached
<infra-available>
Help:
Expanded Security Maintenance for Infrastructure provides access
to a private ppa which includes available high and critical CVE fixes
for Ubuntu LTS packages in the Ubuntu Main repository between the end
of the standard Ubuntu LTS security maintenance and its end of life.
It is enabled by default with Ubuntu Pro. You can find out more about
the service at https://ubuntu.com/security/esm
Expanded Security Maintenance for Infrastructure provides access to a private
PPA which includes available high and critical CVE fixes for Ubuntu LTS
packages in the Ubuntu Main repository between the end of the standard Ubuntu
LTS security maintenance and its end of life. It is enabled by default with
Ubuntu Pro. You can find out more about the service at
https://ubuntu.com/security/esm
"""
When I run `pro help esm-infra --format json` with sudo
Then I will see the following on stdout:
"""
{"name": "esm-infra", "available": "<infra-available>", "help": "Expanded Security Maintenance for Infrastructure provides access\nto a private ppa which includes available high and critical CVE fixes\nfor Ubuntu LTS packages in the Ubuntu Main repository between the end\nof the standard Ubuntu LTS security maintenance and its end of life.\nIt is enabled by default with Ubuntu Pro. You can find out more about\nthe service at https://ubuntu.com/security/esm\n"}
{"name": "esm-infra", "available": "<infra-available>", "help": "Expanded Security Maintenance for Infrastructure provides access to a private\nPPA which includes available high and critical CVE fixes for Ubuntu LTS\npackages in the Ubuntu Main repository between the end of the standard Ubuntu\nLTS security maintenance and its end of life. It is enabled by default with\nUbuntu Pro. You can find out more about the service at\nhttps://ubuntu.com/security/esm"}
"""
When I verify that running `pro help invalid-service` `with sudo` exits `1`
Then I will see the following on stderr:
Expand Down
109 changes: 0 additions & 109 deletions help_data.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def split_link_deps(reqs_filename):

def _get_data_files():
return [
("/etc/ubuntu-advantage", ["uaclient.conf", "help_data.yaml"]),
("/etc/ubuntu-advantage", ["uaclient.conf"]),
("/etc/update-motd.d", glob.glob("update-motd.d/*")),
("/usr/lib/ubuntu-advantage", glob.glob("lib/[!_]*")),
("/usr/share/keyrings", glob.glob("keyrings/*")),
Expand Down
1 change: 0 additions & 1 deletion uaclient/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
MESSAGES_DIR = DEFAULT_DATA_DIR + MESSAGES_SUBDIR
CANDIDATE_CACHE_PATH = UAC_RUN_PATH + "candidate-version"
DEFAULT_CONFIG_FILE = UAC_ETC_PATH + "uaclient.conf"
DEFAULT_HELP_FILE = UAC_ETC_PATH + "help_data.yaml"
DEFAULT_USER_CONFIG_JSON_FILE = DEFAULT_DATA_DIR + "/user-config.json"
DEFAULT_UPGRADE_CONTRACT_FLAG_FILE = UAC_ETC_PATH + "request-update-contract"
BASE_CONTRACT_URL = "https://contracts.canonical.com"
Expand Down
9 changes: 9 additions & 0 deletions uaclient/entitlements/anbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ class AnboxEntitlement(RepoEntitlement):
title = "Anbox Cloud"
description = "Scalable Android in the cloud"
help_doc_url = "https://anbox-cloud.io"
help_text = """\
Anbox Cloud lets you stream mobile apps securely, at any scale, to any device,
letting you focus on your apps. Run Android in system containers on public or
private clouds with ultra low streaming latency. When the anbox-cloud service
is enabled, by default, the Appliance variant is enabled. Enabling this service
allows orchestration to provision a PPA with the Anbox Cloud resources. This
step also configures the Anbox Management Service (AMS) with the necessary
image server credentials. To learn more about Anbox Cloud, see
https://anbox-cloud.io"""
repo_key_file = "ubuntu-pro-anbox-cloud.gpg"
repo_url_tmpl = "{}"
affordance_check_series = True
Expand Down
Loading

0 comments on commit c04c147

Please sign in to comment.