Skip to content

Commit

Permalink
feat: add type check for argument --artifact-path (#5722)
Browse files Browse the repository at this point in the history
  • Loading branch information
smile37773 authored Jan 4, 2023
1 parent bd50211 commit 4390386
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/spring/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Release History
===============
1.6.1
---
* Add type check for argument `--artifact-path`.

1.6.0
---
* Add argument `--client-auth-certs` in command `az spring app create` and `az spring app update`.
Expand Down
6 changes: 5 additions & 1 deletion src/spring/azext_spring/_deployment_uploadable_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ def __init__(self, upload_url, cli_ctx):
def upload_and_build(self, artifact_path, **_):
if not artifact_path:
raise InvalidArgumentValueError('--artifact-path is not set.')
self._upload(artifact_path)
artifact_type_list = {'.zip', '.tar.gz', '.tar', '.jar', '.war'}
if os.path.splitext(artifact_path)[-1] in artifact_type_list:
self._upload(artifact_path)
else:
raise InvalidArgumentValueError('Unexpected artifact file type, must be one of .zip, .tar.gz, .tar, .jar, .war.')

def _upload(self, artifact_path):
FileService = get_sdk(self.cli_ctx, ResourceType.DATA_STORAGE, 'file#FileService')
Expand Down
2 changes: 1 addition & 1 deletion src/spring/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Confirm this is the right version number you want and it matches your
# HISTORY.rst entry.
VERSION = '1.6.0'
VERSION = '1.6.1'

# The full list of classifiers is available at
# https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down

0 comments on commit 4390386

Please sign in to comment.