Skip to content

Commit 186bc0d

Browse files
Fix: Return default API version if available in _resolve_api_version function
1 parent e40d423 commit 186bc0d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/azure-cli/azure/cli/command_modules/rdbms/_flexible_server_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,8 @@ def _resolve_api_version(client, provider_namespace, resource_type, parent_path)
306306
if t.resource_type.lower() == resource_type_str.lower()]
307307
if not rt:
308308
raise InvalidArgumentValueError('Resource type {} not found.'.format(resource_type_str))
309+
if len(rt) == 1 and rt[0].default_api_version not in (None, ''):
310+
return rt[0].default_api_version
309311
if len(rt) == 1 and rt[0].api_versions:
310312
npv = [v for v in rt[0].api_versions if 'preview' not in v.lower()]
311313
return npv[0] if npv else rt[0].api_versions[0]

0 commit comments

Comments
 (0)