Skip to content

Commit 9d7a177

Browse files
authored
[ImageCopy] Fix the issue for sasTokenParsing, removing python related warnings from the sasToken(cmd_output is unfiltered) (#8917)
1 parent c464eba commit 9d7a177

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

src/image-copy/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
Release History
44
===============
55

6+
1.0.3
7+
++++++
8+
* Fix the issue for sasTokenParsing, removing python related warnings from the sasToken(cmd_output was unfiltered)
9+
610
1.0.2
711
++++++
812
* Create temporary storage account with minimum TLS version set to `TLS1_2`

src/image-copy/azext_imagecopy/create_target.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
import datetime
77
import time
88

9-
from knack.util import CLIError
9+
from azext_imagecopy.cli_utils import (get_storage_account_id_from_blob_path,
10+
prepare_cli_command, run_cli_command)
1011
from knack.log import get_logger
11-
12-
from azext_imagecopy.cli_utils import run_cli_command, prepare_cli_command, get_storage_account_id_from_blob_path
12+
from knack.util import CLIError
1313

1414
logger = get_logger(__name__)
1515

@@ -73,6 +73,10 @@ def create_target_image(location, transient_resource_group_name, source_type, so
7373

7474
sas_token = run_cli_command(cli_cmd)
7575
sas_token = sas_token.rstrip("\n\r") # STRANGE
76+
# Remove python related warnings from the SAS token if there are warning included in the SAS token
77+
if len(sas_token.split()) > 1:
78+
sas_token = sas_token.split()[-1]
79+
7680
logger.debug("sas token: %s", sas_token)
7781

7882
# create a container in the target blob storage account
@@ -206,7 +210,7 @@ def wait_for_blob_copy_operation(blob_name, target_container_name, target_storag
206210

207211

208212
def get_random_string(length):
209-
import string
210213
import random
214+
import string
211215
chars = string.ascii_lowercase + string.digits
212216
return ''.join(random.choice(chars) for _ in range(length))

src/image-copy/setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
# --------------------------------------------------------------------------------------------
77

88
from codecs import open
9-
from setuptools import setup, find_packages
9+
from setuptools import find_packages, setup
1010

11-
VERSION = "1.0.2"
11+
VERSION = "1.0.3"
1212

1313
CLASSIFIERS = [
1414
'Development Status :: 4 - Beta',

0 commit comments

Comments
 (0)