Skip to content

Commit 8f4af0a

Browse files
Error on missing x-linode-cli-command extension; log on implicit action
1 parent 5612fe9 commit 8f4af0a

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

linodecli/cli.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,12 @@ def bake(self, spec_location: str):
7373
}
7474

7575
for path in spec.paths.values():
76-
command = path.extensions.get(ext["command"], "default")
76+
command = path.extensions.get(ext["command"], None)
77+
if command is None:
78+
raise KeyError(
79+
f"Path {path} is missing {ext['command']} extension"
80+
)
81+
7782
for m in METHODS:
7883
operation = getattr(path, m)
7984

@@ -89,14 +94,22 @@ def bake(self, spec_location: str):
8994

9095
if ext["skip"] in operation.extensions:
9196
logger.debug(
92-
"%s: Skipping operation due to x-linode-cli-skip extension",
97+
"%s: Skipping operation due to %s extension",
9398
operation_log_fmt,
99+
ext["skip"],
94100
)
95101
continue
96102

97-
action = operation.extensions.get(
98-
ext["action"], operation.operationId
99-
)
103+
action = operation.extensions.get(ext["action"], None)
104+
105+
if action is None:
106+
action = operation.operationId
107+
logger.info(
108+
"%s: Using operationId (%s) as action because %s extension is not specified",
109+
operation_log_fmt,
110+
ext["action"],
111+
)
112+
100113
if not action:
101114
logger.warning(
102115
"%s: Skipping operation due to unresolvable action",

0 commit comments

Comments
 (0)