Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pro enable landscape (SC-1508) #2656

Merged
merged 9 commits into from
Jul 31, 2023
3 changes: 3 additions & 0 deletions .github/workflows/ci-integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ jobs:
UACLIENT_BEHAVE_CONTRACT_TOKEN: '${{ secrets.UACLIENT_BEHAVE_CONTRACT_TOKEN }}'
UACLIENT_BEHAVE_CONTRACT_TOKEN_STAGING: '${{ secrets.UACLIENT_BEHAVE_CONTRACT_TOKEN_STAGING }}'
UACLIENT_BEHAVE_CONTRACT_TOKEN_STAGING_EXPIRED: '${{ secrets.UACLIENT_BEHAVE_CONTRACT_TOKEN_STAGING_EXPIRED }}'
UACLIENT_BEHAVE_LANDSCAPE_REGISTRATION_KEY: '${{ secrets.UACLIENT_BEHAVE_LANDSCAPE_REGISTRATION_KEY }}'
UACLIENT_BEHAVE_LANDSCAPE_API_ACCESS_KEY: '${{ secrets.UACLIENT_BEHAVE_LANDSCAPE_API_ACCESS_KEY }}'
UACLIENT_BEHAVE_LANDSCAPE_API_SECRET_KEY: '${{ secrets.UACLIENT_BEHAVE_LANDSCAPE_API_SECRET_KEY }}'
run: |
PYCLOUDLIB_CONFIG="$(mktemp --tmpdir="${{ runner.temp }}" pycloudlib.toml.XXXXXXXXXX)"
GCE_CREDENTIALS_PATH="$(mktemp --tmpdir="${{ runner.temp }}" gcloud.json.XXXXXXXXXX)"
Expand Down
37 changes: 25 additions & 12 deletions features/attached_commands.feature
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription

Examples: ubuntu release
| release | valid_services |
| xenial | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| bionic | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| focal | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| jammy | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| xenial | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| bionic | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| focal | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |
| jammy | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |

@series.lts
@uses.config.machine_type.lxd-container
Expand Down Expand Up @@ -176,10 +176,10 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription

Examples: ubuntu release
| release | msg |
| xenial | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| bionic | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| focal | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| jammy | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| xenial | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| bionic | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| focal | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |
| jammy | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |

@series.lts
@uses.config.machine_type.lxd-container
Expand Down Expand Up @@ -219,6 +219,7 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
esm-infra +yes +Expanded Security Maintenance for Infrastructure
fips +<fips> +NIST-certified core packages
fips-updates +<fips> +NIST-certified core packages with priority security updates
landscape +(yes|no) +Management and administration tool for Ubuntu
livepatch +(yes|no) +(Canonical Livepatch service|Current kernel is not supported)
realtime-kernel +<realtime-kernel> +Ubuntu kernel with PREEMPT_RT patches integrated
ros +<ros> +Security Updates for the Robot Operating System
Expand Down Expand Up @@ -428,10 +429,10 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription

Examples: ubuntu release
| release | msg |
| xenial | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| bionic | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| focal | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| jammy | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| xenial | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| bionic | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| focal | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |
| jammy | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |

@series.xenial
@series.bionic
Expand Down Expand Up @@ -488,6 +489,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
\(https://ubuntu.com/security/livepatch\)
"""
Expand All @@ -508,6 +511,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
\(https://ubuntu.com/security/livepatch\)
"""
Expand All @@ -528,6 +533,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
\(https://ubuntu.com/security/livepatch\)
- realtime-kernel: Ubuntu kernel with PREEMPT_RT patches integrated
Expand Down Expand Up @@ -596,6 +603,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
\(https://ubuntu.com/security/livepatch\)
- realtime-kernel: Ubuntu kernel with PREEMPT_RT patches integrated
Expand All @@ -622,6 +631,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
\(https://ubuntu.com/security/livepatch\)
- realtime-kernel: Ubuntu kernel with PREEMPT_RT patches integrated
Expand All @@ -648,6 +659,8 @@ Feature: Command behaviour when attached to an Ubuntu Pro subscription
\(https://ubuntu.com/security/certifications#fips\)
- fips: NIST-certified core packages
\(https://ubuntu.com/security/certifications#fips\)
- landscape: Management and administration tool for Ubuntu
\(https://ubuntu.com/landscape\)
- livepatch: Canonical Livepatch service
\(https://ubuntu.com/security/livepatch\)
- realtime-kernel: Ubuntu kernel with PREEMPT_RT patches integrated
Expand Down
16 changes: 8 additions & 8 deletions features/attached_enable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ Feature: Enable command behaviour when attached to an Ubuntu Pro subscription

Examples: ubuntu release
| release | valid_services |
| xenial | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| bionic | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| focal | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| jammy | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| xenial | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| bionic | anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| focal | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |
| jammy | anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |

@series.lts
@uses.config.machine_type.lxd-container
Expand Down Expand Up @@ -247,9 +247,9 @@ Feature: Enable command behaviour when attached to an Ubuntu Pro subscription

Examples: ubuntu release
| release | infra-pkg | esm-infra-url | msg |
| xenial | libkrad0 | https://esm.ubuntu.com/infra/ubuntu | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| bionic | libkrad0 | https://esm.ubuntu.com/infra/ubuntu | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel, ros, ros-updates. |
| focal | hello | https://esm.ubuntu.com/infra/ubuntu | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, livepatch,\nrealtime-kernel, ros, ros-updates, usg. |
| xenial | libkrad0 | https://esm.ubuntu.com/infra/ubuntu | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| bionic | libkrad0 | https://esm.ubuntu.com/infra/ubuntu | Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates. |
| focal | hello | https://esm.ubuntu.com/infra/ubuntu | Try anbox-cloud, cc-eal, esm-apps, esm-infra, fips, fips-updates, landscape,\nlivepatch, realtime-kernel, ros, ros-updates, usg. |

@series.all
@uses.config.machine_type.lxd-container
Expand Down Expand Up @@ -488,7 +488,7 @@ Feature: Enable command behaviour when attached to an Ubuntu Pro subscription
And stderr matches regexp:
"""
Cannot enable unknown service 'usg'.
Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlivepatch, realtime-kernel.
Try anbox-cloud, cc-eal, cis, esm-apps, esm-infra, fips, fips-updates,\nlandscape, livepatch, realtime-kernel, ros, ros-updates\.
"""

Examples: cis service
Expand Down
22 changes: 17 additions & 5 deletions features/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ class UAClientBehaveConfig:
"contract_token",
"contract_token_staging",
"contract_token_staging_expired",
"landscape_registration_key",
"landscape_api_access_key",
"landscape_api_secret_key",
"machine_type",
"private_key_file",
"private_key_name",
Expand All @@ -102,6 +105,9 @@ class UAClientBehaveConfig:
"contract_token",
"contract_token_staging",
"contract_token_staging_expired",
"landscape_registration_key",
"landscape_api_access_key",
"landscape_api_secret_key",
]

# This variable is used in .from_environ() but also to emit the "Config
Expand All @@ -124,6 +130,9 @@ def __init__(
contract_token: Optional[str] = None,
contract_token_staging: Optional[str] = None,
contract_token_staging_expired: Optional[str] = None,
landscape_registration_key: Optional[str] = None,
landscape_api_access_key: Optional[str] = None,
landscape_api_secret_key: Optional[str] = None,
artifact_dir: str = "artifacts",
install_from: InstallationSource = InstallationSource.LOCAL,
custom_ppa: Optional[str] = None,
Expand All @@ -141,6 +150,9 @@ def __init__(
self.contract_token = contract_token
self.contract_token_staging = contract_token_staging
self.contract_token_staging_expired = contract_token_staging_expired
self.landscape_registration_key = landscape_registration_key
self.landscape_api_access_key = landscape_api_access_key
self.landscape_api_secret_key = landscape_api_secret_key
self.image_clean = image_clean
self.destroy_instances = destroy_instances
self.machine_type = machine_type
Expand Down Expand Up @@ -285,17 +297,17 @@ def from_environ(cls, config) -> "UAClientBehaveConfig":
continue
kwargs[our_key] = value

# userdata should override environment variables
kwargs.update(config.userdata)

# Next, sanitise the non-string options to Python types
for key in cls.boolean_options:
bool_value = True # Default to True
if key in kwargs:
if kwargs[key] == "0":
if kwargs[key] == "0" or str(kwargs[key]).lower() == "false":
bool_value = False
kwargs[key] = bool_value

# userdata should override environment variables
kwargs.update(config.userdata)

if "install_from" in kwargs:
kwargs["install_from"] = InstallationSource(kwargs["install_from"])

Expand Down Expand Up @@ -455,7 +467,7 @@ def before_scenario(context: Context, scenario: Scenario):
for step in scenario.steps:
if step.text:
step.text = process_template_vars(
context, step.text, logger_fn=logger.warn
context, step.text, logger_fn=logger.warn, shown=True
)


Expand Down
Loading
Loading