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

plan: fix error when variable is not set #2808

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions features/api_fix_plan.feature
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,19 @@ Feature: Fix plan API endpoints
Examples: ubuntu release details
| release |
| bionic |

@series.mantic
@uses.config.machine_type.lxd-vm
Scenario Outline: Fix command on an unattached machine
Given a `<release>` machine with ubuntu-advantage-tools installed
When I run `pro api u.pro.security.fix.cve.plan.v1 --data '{"cves": ["CVE-2022-40982"]}'` as non-root
Then stdout is a json matching the `api_response` schema
And the json API response data matches the `cve_fix_plan` schema
And stdout matches regexp:
"""
{"_schema_version": "v1", "data": {"attributes": {"cves_data": {"cves": \[{"additional_data": {}, "affected_packages": \["linux"\], "description": ".*", "error": null, "expected_status": "still-affected", "plan": \[\], "title": "CVE-2022-40982", "warnings": \[{"data": {"source_packages": \["linux"\], "status": "pending"}, "order": 1, "warning_type": "security-issue-not-fixed"}\]}\], "expected_status": "still-affected"}}, "meta": {"environment_vars": \[\]}, "type": "CVEFixPlan"}, "errors": \[\], "result": "success", "version": ".*", "warnings": \[\]}
"""

Examples: ubuntu release details
| release |
| mantic |
2 changes: 2 additions & 0 deletions uaclient/api/u/pro/security/fix/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,8 @@ def _generate_fix_plan(
additional_data=None
) -> FixPlanResult:
count = len(affected_pkg_status)
src_pocket_pkgs = defaultdict(list)

fix_plan = get_fix_plan(
title=issue_id,
description=issue_description,
Expand Down
Loading