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

[Core] Fix #18360 and #18262: write to stderr issue #18414

Merged
merged 3 commits into from
Jun 10, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,13 @@ def __init__(self, command_loader, op_path, **merged_kwargs):
super(WaitCommandOperation, self).__init__(command_loader, **merged_kwargs)
self.op_path = op_path

def handler(self, command_args): # pylint: disable=too-many-statements
def handler(self, command_args): # pylint: disable=too-many-statements, too-many-locals
""" Callback function of CLICommand handler """
from msrest.exceptions import ClientException
from azure.core.exceptions import HttpResponseError
from knack.util import CLIError
from azure.cli.core.commands.arm import EXCLUDED_NON_CLIENT_PARAMS, verify_property
from azure.cli.core.commands.progress import IndeterminateProgressBar

import time

Expand Down Expand Up @@ -416,11 +417,11 @@ def handler(self, command_args): # pylint: disable=too-many-statements
raise CLIError(
"incorrect usage: --created | --updated | --deleted | --exists | --custom JMESPATH")

progress_indicator = self.cli_ctx.get_progress_controller()
progress_indicator = IndeterminateProgressBar(self.cli_ctx, message='Waiting')
progress_indicator.begin()
for _ in range(0, timeout, interval):
try:
progress_indicator.add(message='Waiting')
progress_indicator.update_progress()
instance = getter(**command_args)
if wait_for_exists:
progress_indicator.end()
Expand Down
3 changes: 2 additions & 1 deletion src/azure-cli-core/azure/cli/core/commands/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ def write(self, args):
pass

def clear(self):
self.out.write('%s\r' % EMPTY_LINE)
self.spinner.clear()
self.out.flush()

def flush(self):
self.out.flush()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interactions:
ParameterSetName:
- -n --no-wait --yes
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: DELETE
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
Expand All @@ -27,11 +27,11 @@ interactions:
content-length:
- '0'
date:
- Fri, 16 Apr 2021 01:53:54 GMT
- Wed, 09 Jun 2021 07:24:02 GMT
expires:
- '-1'
location:
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZSRzo1Rk5PV0FJVDo1RlRFU1RXVUVIUUpMSFpWNTcyQUYyT0FWSDdMRHwwREMzOUM5NDcwODJDNjBFLVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-10-01
- https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/operationresults/eyJqb2JJZCI6IlJFU09VUkNFR1JPVVBERUxFVElPTkpPQi1DTEk6NUZSRzo1Rk5PV0FJVDo1RlRFU1Q1N1BCS1VCQ1RITjY2SUZLN09HSlVaUnxEMUFGRUQ3OUYwMTVFODFELVdFU1RVUyIsImpvYkxvY2F0aW9uIjoid2VzdHVzIn0?api-version=2020-10-01
pragma:
- no-cache
strict-transport-security:
Expand All @@ -57,12 +57,12 @@ interactions:
ParameterSetName:
- --deleted -n
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-04-16T01:53:49Z"},"properties":{"provisioningState":"Deleting"}}'
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-06-09T07:23:45Z"},"properties":{"provisioningState":"Deleting"}}'
headers:
cache-control:
- no-cache
Expand All @@ -71,7 +71,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 16 Apr 2021 01:53:54 GMT
- Wed, 09 Jun 2021 07:24:02 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -99,12 +99,12 @@ interactions:
ParameterSetName:
- --deleted -n
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
body:
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-04-16T01:53:49Z"},"properties":{"provisioningState":"Deleting"}}'
string: '{"id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/cli_rg_nowait_test000001","name":"cli_rg_nowait_test000001","type":"Microsoft.Resources/resourceGroups","location":"westus","tags":{"product":"azurecli","cause":"automation","date":"2021-06-09T07:23:45Z"},"properties":{"provisioningState":"Deleting"}}'
headers:
cache-control:
- no-cache
Expand All @@ -113,7 +113,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 16 Apr 2021 01:54:24 GMT
- Wed, 09 Jun 2021 07:24:32 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -141,7 +141,7 @@ interactions:
ParameterSetName:
- --deleted -n
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
Expand All @@ -156,7 +156,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 16 Apr 2021 01:54:55 GMT
- Wed, 09 Jun 2021 07:25:02 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -184,7 +184,7 @@ interactions:
ParameterSetName:
- -n
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: HEAD
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
Expand All @@ -198,7 +198,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 16 Apr 2021 01:54:55 GMT
- Wed, 09 Jun 2021 07:25:03 GMT
expires:
- '-1'
pragma:
Expand Down Expand Up @@ -230,7 +230,7 @@ interactions:
ParameterSetName:
- -n -l --managed-by
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: PUT
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
Expand All @@ -244,7 +244,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 16 Apr 2021 01:54:58 GMT
- Wed, 09 Jun 2021 07:25:06 GMT
expires:
- '-1'
pragma:
Expand All @@ -254,7 +254,7 @@ interactions:
x-content-type-options:
- nosniff
x-ms-ratelimit-remaining-subscription-writes:
- '1198'
- '1199'
status:
code: 201
message: Created
Expand All @@ -272,7 +272,7 @@ interactions:
ParameterSetName:
- -n
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: HEAD
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
Expand All @@ -284,7 +284,7 @@ interactions:
content-length:
- '0'
date:
- Fri, 16 Apr 2021 01:54:59 GMT
- Wed, 09 Jun 2021 07:25:07 GMT
expires:
- '-1'
pragma:
Expand All @@ -310,7 +310,7 @@ interactions:
ParameterSetName:
- --exists -n
User-Agent:
- AZURECLI/2.21.0 azsdk-python-azure-mgmt-resource/16.0.0 Python/3.8.0 (Windows-10-10.0.19041-SP0)
- AZURECLI/2.24.0 azsdk-python-azure-mgmt-resource/18.0.0 Python/3.7.7 (Windows-10-10.0.19041-SP0)
method: GET
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/cli_rg_nowait_test000001?api-version=2020-10-01
response:
Expand All @@ -324,7 +324,7 @@ interactions:
content-type:
- application/json; charset=utf-8
date:
- Fri, 16 Apr 2021 01:54:59 GMT
- Wed, 09 Jun 2021 07:25:07 GMT
expires:
- '-1'
pragma:
Expand Down