-
Notifications
You must be signed in to change notification settings - Fork 75
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
refactor: simplify prerm to not import python #2783
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
import os | ||
import re | ||
import subprocess | ||
import sys | ||
import tempfile | ||
from functools import lru_cache, wraps | ||
from typing import Dict, Iterable, List, NamedTuple, Optional, Set, Union | ||
|
@@ -661,43 +660,6 @@ def remove_apt_list_files(repo_url, series): | |
system.ensure_file_absent(path) | ||
|
||
|
||
def clean_apt_files(*, _entitlements=None): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. removing code and keeping functionality? good good |
||
""" | ||
Clean apt files written by uaclient | ||
|
||
:param _entitlements: | ||
The uaclient.entitlements module to use, defaults to | ||
uaclient.entitlements. (This is only present for testing, because the | ||
import happens within the function to avoid circular imports.) | ||
""" | ||
from uaclient.entitlements.repo import RepoEntitlement | ||
|
||
if _entitlements is None: | ||
from uaclient import entitlements as __entitlements | ||
|
||
_entitlements = __entitlements | ||
|
||
for ent_cls in _entitlements.ENTITLEMENT_CLASSES: | ||
if not issubclass(ent_cls, RepoEntitlement): | ||
continue | ||
repo_file = ent_cls.repo_list_file_tmpl.format(name=ent_cls.name) | ||
pref_file = ent_cls.repo_pref_file_tmpl.format(name=ent_cls.name) | ||
if os.path.exists(repo_file): | ||
event.info( | ||
messages.APT_REMOVING_SOURCE_FILE.format(filename=repo_file), | ||
file_type=sys.stderr, | ||
) | ||
system.ensure_file_absent(repo_file) | ||
if os.path.exists(pref_file): | ||
event.info( | ||
messages.APT_REMOVING_PREFERENCES_FILE.format( | ||
filename=pref_file | ||
), | ||
file_type=sys.stderr, | ||
) | ||
system.ensure_file_absent(pref_file) | ||
|
||
|
||
def is_installed(pkg: str) -> bool: | ||
return pkg in get_installed_packages_names() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we also need
usg
hereThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't hurt, but is the apt source file named with the
presented_as
name?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, source-file and key will be
ubuntu-cis.list
unfortunately 🤡 :upset_cry: