Skip to content

Commit dd25b6d

Browse files
committed
cli: Parse --offline carefully: not all commands have the flag
Signed-off-by: Jussi Kukkonen <[email protected]>
1 parent 4376d4f commit dd25b6d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

sigstore/_cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,12 +1165,15 @@ def _get_trust_config(args: argparse.Namespace) -> ClientTrustConfig:
11651165
The configuration may come from explicit argument (--trust-config) or from the TUF
11661166
repository of the used Sigstore instance.
11671167
"""
1168+
# Some commands do not have offline argument, parse carefully
1169+
offline = args.offline if "offline" in args else False
1170+
11681171
if args.trust_config:
11691172
return ClientTrustConfig.from_json(args.trust_config.read_text())
11701173
elif args.staging:
1171-
return ClientTrustConfig.staging(offline=args.offline)
1174+
return ClientTrustConfig.staging(offline=offline)
11721175
else:
1173-
return ClientTrustConfig.production(offline=args.offline)
1176+
return ClientTrustConfig.production(offline=offline)
11741177

11751178

11761179
def _get_identity(

0 commit comments

Comments
 (0)