Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix two issues in storage module. #5168

Merged
merged 3 commits into from
Dec 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 1 addition & 52 deletions scripts/ci/test_static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,58 +19,7 @@ proc_number=`python -c 'import multiprocessing; print(multiprocessing.cpu_count(

echo "Run pylint with $proc_number proc."

# Uncommented after all conversion is done
# pylint azure.cli --rcfile=./pylintrc -j $proc_number

proc_number=`python -c 'import multiprocessing; print(multiprocessing.cpu_count())'`
exit_code=0

run_style() {
pylint $1 --rcfile=./pylintrc -j $proc_number
let exit_code=$exit_code+$?
}


set +e

run_style azure.cli.core
run_style azure.cli.command_modules.acr
run_style azure.cli.command_modules.acs
run_style azure.cli.command_modules.advisor
run_style azure.cli.command_modules.appservice
run_style azure.cli.command_modules.backup
run_style azure.cli.command_modules.batch
run_style azure.cli.command_modules.batchai
run_style azure.cli.command_modules.billing
run_style azure.cli.command_modules.cdn
run_style azure.cli.command_modules.cloud
run_style azure.cli.command_modules.cognitiveservices
run_style azure.cli.command_modules.configure
run_style azure.cli.command_modules.container
run_style azure.cli.command_modules.consumption
run_style azure.cli.command_modules.cosmosdb
run_style azure.cli.command_modules.dla
run_style azure.cli.command_modules.dls
run_style azure.cli.command_modules.eventgrid
run_style azure.cli.command_modules.extension
run_style azure.cli.command_modules.feedback
run_style azure.cli.command_modules.find
run_style azure.cli.command_modules.interactive
run_style azure.cli.command_modules.iot
run_style azure.cli.command_modules.keyvault
run_style azure.cli.command_modules.lab
run_style azure.cli.command_modules.monitor
run_style azure.cli.command_modules.network
run_style azure.cli.command_modules.profile
run_style azure.cli.command_modules.rdbms
run_style azure.cli.command_modules.redis
run_style azure.cli.command_modules.reservations
run_style azure.cli.command_modules.resource
run_style azure.cli.command_modules.role
run_style azure.cli.command_modules.servicefabric
run_style azure.cli.command_modules.sql
run_style azure.cli.command_modules.storage
run_style azure.cli.testsdk
run_style azure.cli.command_modules.vm
pylint azure.cli --rcfile=./pylintrc -j $proc_number

exit $exit_code
2 changes: 1 addition & 1 deletion src/azure-cli-core/azure/cli/core/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def command(self, name, method_name=None, **kwargs):

def custom_command(self, name, method_name, **kwargs):
"""
Register a custome CLI command.
Register a custom CLI command.
:param name: Name of the command as it will be called on the command line
:type name: str
:param method_name: Name of the method the command maps to
Expand Down
1 change: 0 additions & 1 deletion src/azure-cli-testsdk/azure/cli/testsdk/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def force_progress_logging():
from six import StringIO
import logging
from azure.cli.core.commands import logger as cmd_logger
from azure.cli.testsdk import TestCli

# register a progress logger handler to get the content to verify
test_io = StringIO()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ def handler(ex):
def _register_data_plane_account_arguments(self, command_name):
""" Add parameters required to create a storage client """
from azure.cli.command_modules.storage._validators import validate_client_parameters
command = self.command_loader.command_table[command_name]
command = self.command_loader.command_table.get(command_name, None)
if not command:
return

group_name = 'Storage Account'
command.add_argument('account_name', '--account-name', required=False, default=None,
arg_group=group_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def action_file_copy(file_info):
timeout=timeout, existing_dirs=existing_dirs)

return list(filter_none(
action_file_copy(file) for file in collect_files(cmd.cli_ctx, source_client, source_share, pattern)))
action_file_copy(file) for file in collect_files(cmd, source_client, source_share, pattern)))
else:
# won't happen, the validator should ensure either source_container or source_share is set
raise ValueError('Fail to find source. Neither blob container or file share is specified.')
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,8 @@ def make_encoded_file_url_and_params(file_service, share, file_dir, file_name, s
file_dir = file_dir.encode('utf-8')
file_name = file_name.encode('utf-8')
file_url = file_service.make_file_url(share, file_dir, file_name, sas_token=sas_token)
file_url = file_url.replace('//', '/')

if not file_dir:
sep = file_url.find('://')
file_url = file_url[:sep + 3] + file_url[sep + 3:].replace('//', '/')
return encode_url_path(file_url, safe), file_dir, file_name
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ def collect_blobs(blob_service, container, pattern=None):
if not _pattern_has_wildcards(pattern):
return [pattern] if blob_service.exists(container, pattern) else []

return (blob.name for blob in blob_service.list_blobs(container) if _match_path(pattern, blob.name))
results = []
for blob in blob_service.list_blobs(container):
try:
blob_name = blob.name.encode('utf-8') if isinstance(blob.name, unicode) else blob.name
except NameError:
blob_name = blob.name

if _match_path(pattern, blob_name):
results.append(blob_name)

return results


def collect_files(cmd, file_service, share, pattern=None):
Expand Down