| 1 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 2 |
import configparser |
| 3 |
import sys |
| 4 |
|
| 5 |
c = configparser.ConfigParser() |
| 6 |
c.read("/etc/sos/sos.conf") |
| 7 |
try: |
| 8 |
print(c["global"]["tmp-dir"]) |
| 9 |
except KeyError: |
| 10 |
# very expensive and internal API, but there is no official way to get the tmp-dir |
| 11 |
# https://github.com/sosreport/sos/issues/4074 |
| 12 |
try: |
| 13 |
import sos.policies |
| 14 |
print(sos.policies.load().get_tmp_dir(None)) |
| 15 |
except Exception as e: |
| 16 |
# in case the API changes, sane fallback |
| 17 |
print("Failed to get policy tmp-dir:", e, file=sys.stderr) |
| 18 |
print("/var/tmp") |