Skip to content
Merged
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
13 changes: 13 additions & 0 deletions seinfo
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import logging
import signal
import ipaddress
import warnings
from pathlib import Path
from typing import Callable, List, Tuple


Expand Down Expand Up @@ -102,6 +103,18 @@ xen.add_argument("--devicetreecon", help="Print all devicetreecon statements.",

args = parser.parse_args()

# Fix argument misparsing: when policy is None and a query option is a string,
# check if the string is actually a policy file that is incorrectly consumed by the query option
if not args.policy:
# Check all query options defined in the queries argument group
for action in queries._group_actions:
value = getattr(args, action.dest, None)
if isinstance(value, str) and Path(value).exists():
# This query argument consumed the policy path - fix it
args.policy = value
setattr(args, action.dest, True)
break

if args.debug:
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s|%(levelname)s|%(name)s|%(message)s')
Expand Down