Skip to content

Commit

Permalink
Allow user to specify custom client_arg_name (#5139)
Browse files Browse the repository at this point in the history
* Allow user to specify custom client_arg_name

* Update versions for CI

* Fix pylint
  • Loading branch information
derekbekoe authored Dec 20, 2017
1 parent 23728f4 commit 6808e6b
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/azure-cli-core/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
Release History
===============

2.0.24
++++++
* Minor fixes

2.0.23
++++++
* Minor fixes

2.0.22
++++++
* Minor fixes
Expand Down
5 changes: 3 additions & 2 deletions src/azure-cli-core/azure/cli/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# --------------------------------------------------------------------------------------------
from __future__ import print_function

__version__ = "2.0.22"
__version__ = "2.0.24"

import os
import sys
Expand Down Expand Up @@ -319,7 +319,8 @@ def default_command_handler(command_args):

client = client_factory(self.cli_ctx, command_args) if client_factory else None
if client:
client_arg_name = 'client' if operation.startswith(('azure.cli', 'azext')) else 'self'
client_arg_name = kwargs.get('client_arg_name',
'client' if operation.startswith(('azure.cli', 'azext')) else 'self')
if client_arg_name in op_args:
command_args[client_arg_name] = client
result = op(**command_args)
Expand Down
3 changes: 2 additions & 1 deletion src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
logger = get_logger(__name__)

CLI_COMMAND_KWARGS = ['transform', 'table_transformer', 'confirmation', 'exception_handler', 'min_api', 'max_api',
'client_factory', 'operations_tmpl', 'no_wait_param', 'validator', 'resource_type']
'client_factory', 'operations_tmpl', 'no_wait_param', 'validator', 'resource_type',
'client_arg_name']

CONFIRM_PARAM_NAME = 'yes'

Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli-core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}

VERSION = "2.0.22"
VERSION = "2.0.24"
# If we have source, validate that our version numbers match
# This should prevent uploading releases with mismatched versions.
try:
Expand Down
8 changes: 8 additions & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
Release History
===============

2.0.24
++++++
* Minor fixes

2.0.23
++++++
* Minor fixes

2.0.22
++++++
* Remove `az component` commands. Use `az extension` instead. `az component` has been deprecated for several months now.
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
pkg_resources.declare_namespace(__name__)

__author__ = "Microsoft Corporation <python@microsoft.com>"
__version__ = "2.0.22"
__version__ = "2.0.24"
2 changes: 1 addition & 1 deletion src/azure-cli/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
logger.warn("Wheel is not available, disabling bdist_wheel hook")
cmdclass = {}

VERSION = "2.0.22"
VERSION = "2.0.24"
# If we have source, validate that our version numbers match
# This should prevent uploading releases with mismatched versions.
try:
Expand Down

0 comments on commit 6808e6b

Please sign in to comment.