Skip to content

Commit

Permalink
chore: update charm libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] authored Jan 10, 2024
1 parent ef2c98d commit 21cda43
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/charms/operator_libs_linux/v0/apt.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
import subprocess
from collections.abc import Mapping
from enum import Enum
from subprocess import PIPE, CalledProcessError, check_call, check_output
from subprocess import PIPE, CalledProcessError, check_output
from typing import Iterable, List, Optional, Tuple, Union
from urllib.parse import urlparse

Expand All @@ -122,7 +122,7 @@

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 11
LIBPATCH = 13


VALID_SOURCE_TYPES = ("deb", "deb-src")
Expand Down Expand Up @@ -250,10 +250,10 @@ def _apt(
try:
env = os.environ.copy()
env["DEBIAN_FRONTEND"] = "noninteractive"
check_call(_cmd, env=env, stderr=PIPE, stdout=PIPE)
subprocess.run(_cmd, capture_output=True, check=True, text=True, env=env)
except CalledProcessError as e:
raise PackageError(
"Could not {} package(s) [{}]: {}".format(command, [*package_names], e.output)
"Could not {} package(s) [{}]: {}".format(command, [*package_names], e.stderr)
) from None

def _add(self) -> None:
Expand Down Expand Up @@ -476,7 +476,7 @@ def from_apt_cache(
)
except CalledProcessError as e:
raise PackageError(
"Could not list packages in apt-cache: {}".format(e.output)
"Could not list packages in apt-cache: {}".format(e.stderr)
) from None

pkg_groups = output.strip().split("\n\n")
Expand Down Expand Up @@ -748,7 +748,7 @@ def add_package(

packages = {"success": [], "retry": [], "failed": []}

package_names = [package_names] if type(package_names) is str else package_names
package_names = [package_names] if isinstance(package_names, str) else package_names
if not package_names:
raise TypeError("Expected at least one package name to add, received zero!")

Expand Down Expand Up @@ -818,7 +818,7 @@ def remove_package(
"""
packages = []

package_names = [package_names] if type(package_names) is str else package_names
package_names = [package_names] if isinstance(package_names, str) else package_names
if not package_names:
raise TypeError("Expected at least one package name to add, received zero!")

Expand All @@ -837,7 +837,7 @@ def remove_package(

def update() -> None:
"""Update the apt cache via `apt-get update`."""
check_call(["apt-get", "update"], stderr=PIPE, stdout=PIPE)
subprocess.run(["apt-get", "update"], capture_output=True, check=True)


def import_key(key: str) -> str:
Expand Down

0 comments on commit 21cda43

Please sign in to comment.