Skip to content

Commit

Permalink
Suppress some unhelpful errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexSv04047 committed Dec 9, 2023
1 parent 6e9aefe commit cd9aa69
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
9 changes: 4 additions & 5 deletions cloudinit/dmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,14 @@ def _read_kenv(key: str) -> Optional[str]:

LOG.debug("querying dmi data %s", kmap.freebsd)

cmd = ["kenv", "-q", kmap.freebsd]

try:
cmd = ["kenv", "-q", kmap.freebsd]
(result, _err) = subp.subp(cmd)
result = result.strip()
LOG.debug("kenv returned '%s' for '%s'", result, kmap.freebsd)
return result
except subp.ProcessExecutionError as e:
LOG.debug("failed kenv cmd: %s\n%s", cmd, e)
LOG.debug("failed kenv cmd: %s\n%s", cmd, e) # type: ignore

return None

Expand All @@ -126,16 +125,16 @@ def _call_dmidecode(key: str, dmidecode_path: str) -> Optional[str]:
Calls out to dmidecode to get the data out. This is mostly for supporting
OS's without /sys/class/dmi/id support.
"""
cmd = [dmidecode_path, "--string", key]
try:
cmd = [dmidecode_path, "--string", key]
(result, _err) = subp.subp(cmd)
result = result.strip()
LOG.debug("dmidecode returned '%s' for '%s'", result, key)
if result.replace(".", "") == "":
return ""
return result
except subp.ProcessExecutionError as e:
LOG.debug("failed dmidecode cmd: %s\n%s", cmd, e)
LOG.debug("failed dmidecode cmd: %s\n%s", cmd, e) # type: ignore
return None


Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,13 @@ ignore = [
]
[tool.ruff.per-file-ignores]
"cloudinit/cmd/main.py" = ["E402"]

[tool.pyright]
# 1. Suppress "Method {m} overrides class {c} in an incompatible manner"
reportIncompatibleMethodOverride = false
# 2. Suppress "{Method} is not a known member of None"
reportOptionalMemberAccess = false
# 3. Exclude specified files & folders from the check (overwrites include)
exclude = ["cloudinit/apport.py"]
# 4. Include only specified files & folders to the check
include = []

0 comments on commit cd9aa69

Please sign in to comment.