Skip to content
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
4 changes: 4 additions & 0 deletions src/serial-console/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
===============

0.1.2
++++++
* Change to make custom boot diagnostics optional

0.1.1
++++++
* Change to require custom boot diagnostics
Expand Down
2 changes: 1 addition & 1 deletion src/serial-console/azext_serialconsole/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

helps['serial-console'] = """
type: group
short-summary: Connent to the Serial Console of a Linux/Windows Virtual Machine or VMSS Instance.
short-summary: Connect to the Serial Console of a Linux/Windows Virtual Machine or VMSS Instance.
"""

helps['serial-console send'] = """
Expand Down
28 changes: 10 additions & 18 deletions src/serial-console/azext_serialconsole/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -597,14 +597,14 @@ def check_resource(cli_ctx, resource_group_name, vm_vmss_name, vmss_instanceid):
raise AzureConnectionError(
error_message, recommendation=recommendation)

if result.boot_diagnostics is None or result.boot_diagnostics.serial_console_log_blob_uri is None:
error_message = ("Azure Serial Console requires boot diagnostics to be enabled. Additionally, "
"Serial Console requires a custom boot diagnostics storage account to be "
"used, and is not yet fully compatible with managed boot diagnostics storage accounts.")
if result.boot_diagnostics is None:
error_message = ("Azure Serial Console requires boot diagnostics to be enabled.")
recommendation = ('Use "az vmss update --name MyScaleSet --resource-group MyResourceGroup --set '
'virtualMachineProfile.diagnosticsProfile="{\\"bootDiagnostics\\": {\\"Enabled\\" : '
'\\"True\\",\\"StorageUri\\":\\"https://mystorageacct.blob.core.windows.net/\\"}}""'
'to enable boot diagnostics.')
'\\"True\\",\\"StorageUri\\" : null}}"" to enable boot diagnostics. '
'You can replace "null" with a custom storage account '
'\\"https://mystor.blob.windows.net/"\\. Then run "az vmss update-instances -n '
'MyScaleSet -g MyResourceGroup --instance-ids *".')
raise AzureConnectionError(
error_message, recommendation=recommendation)
else:
Expand Down Expand Up @@ -640,21 +640,13 @@ def check_resource(cli_ctx, resource_group_name, vm_vmss_name, vmss_instanceid):
raise AzureConnectionError(
error_message, recommendation=recommendation)

recommendation = ('Use "az vm boot-diagnostics enable --name MyVM --resource-group MyResourceGroup '
'--storage https://mystor.blob.core.windows.net/" to enable boot diagnostics and '
'make sure to specify a storage account with the --storage parameter.')

if (result.diagnostics_profile is None or
result.diagnostics_profile.boot_diagnostics is None or
not result.diagnostics_profile.boot_diagnostics.enabled):
error_message = ("Azure Serial Console requires boot diagnostics to be enabled. Additionally, "
"Serial Console requires a custom boot diagnostics storage account to be "
"used, and is not yet fully compatible with managed boot diagnostics storage accounts.")
raise AzureConnectionError(
error_message, recommendation=recommendation)
if result.diagnostics_profile.boot_diagnostics.storage_uri is None:
error_message = ("Serial Console requires a custom boot diagnostics storage account to be used, "
"and is not yet fully compatible with managed boot diagnostics storage accounts.")
error_message = ("Azure Serial Console requires boot diagnostics to be enabled.")
recommendation = ('Use "az vm boot-diagnostics enable --name MyVM --resource-group MyResourceGroup" '
'to enable boot diagnostics. You can specify a custom storage account with the '
'parameter "--storage https://mystor.blob.windows.net/".')
raise AzureConnectionError(
error_message, recommendation=recommendation)

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 @@ -15,8 +15,8 @@ interactions:
Content-Type:
- application/json
User-Agent:
- AZURECLI/2.27.0 azsdk-python-microsoftserialconsoleclient/unknown Python/3.8.10
(Windows-10-10.0.19042-SP0)
- AZURECLI/2.39.0 azsdk-python-microsoftserialconsoleclient/unknown Python/3.8.13
(Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SerialConsole/consoleServices/default/disableConsole?api-version=2018-05-01
response:
Expand All @@ -30,7 +30,7 @@ interactions:
content-type:
- application/json; charset=UTF-8
date:
- Mon, 02 Aug 2021 18:41:04 GMT
- Thu, 04 Aug 2022 17:10:07 GMT
expires:
- '-1'
pragma:
Expand All @@ -48,7 +48,7 @@ interactions:
x-frame-options:
- deny
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
- '1198'
status:
code: 200
message: OK
Expand All @@ -68,8 +68,8 @@ interactions:
Content-Type:
- application/json
User-Agent:
- AZURECLI/2.27.0 azsdk-python-microsoftserialconsoleclient/unknown Python/3.8.10
(Windows-10-10.0.19042-SP0)
- AZURECLI/2.39.0 azsdk-python-microsoftserialconsoleclient/unknown Python/3.8.13
(Linux-5.10.102.1-microsoft-standard-WSL2-x86_64-with-glibc2.35)
method: POST
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.SerialConsole/consoleServices/default/enableConsole?api-version=2018-05-01
response:
Expand All @@ -83,7 +83,7 @@ interactions:
content-type:
- application/json; charset=UTF-8
date:
- Mon, 02 Aug 2021 18:41:04 GMT
- Thu, 04 Aug 2022 17:10:07 GMT
expires:
- '-1'
pragma:
Expand All @@ -101,7 +101,7 @@ interactions:
x-frame-options:
- deny
x-ms-ratelimit-remaining-subscription-writes:
- '1199'
- '1198'
status:
code: 200
message: OK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ def test_check_resource_VMSS(self, resource_group, storage_account):
self.cmd('az vmss update --name {name} --resource-group {rg} --set virtualMachineProfile.diagnosticsProfile="{{\\"bootDiagnostics\\": {{\\"Enabled\\" : \\"True\\",\\"StorageUri\\" : null}}}}"')
self.cmd('az vmss update-instances -g {rg} -n {name} --instance-ids {id}')

with self.assertRaises(AzureConnectionError):
check_resource(self.cli_ctx, resource_group, name, iid)
check_resource(self.cli_ctx, resource_group, name, iid)

self.cmd('az vmss deallocate -g {rg} -n {name} --instance-ids {id}')

Expand All @@ -62,8 +61,7 @@ def test_check_resource_VMSS(self, resource_group, storage_account):
self.cmd('az vmss start -g {rg} -n {name} --instance-ids {id}')
self.cmd('az vmss stop -g {rg} -n {name} --instance-ids {id}')

with self.assertRaises(AzureConnectionError):
check_resource(self.cli_ctx, resource_group, name, iid)
check_resource(self.cli_ctx, resource_group, name, iid)

self.cmd('az vmss start -g {rg} -n {name} --instance-ids {id}')
self.cmd('az vmss update --name {name} --resource-group {rg} --set virtualMachineProfile.diagnosticsProfile="{{\\"bootDiagnostics\\": {{\\"Enabled\\" : \\"True\\",\\"StorageUri\\":\\"https://{sa}.blob.core.windows.net/\\"}}}}"')
Expand Down Expand Up @@ -113,8 +111,7 @@ def test_check_resource_VMSS(self, resource_group, storage_account):

self.cmd('az vmss update-instances -g {rg} -n {name} --instance-ids {id}')

with self.assertRaises(AzureConnectionError):
check_resource(self.cli_ctx, resource_group, name, iid)
check_resource(self.cli_ctx, resource_group, name, iid)

@ResourceGroupPreparer(name_prefix='cli_test_serialconsole', location='westus2')
@StorageAccountPreparer(name_prefix='cli', location="westus2")
Expand All @@ -141,8 +138,7 @@ def test_check_resource_VM(self, resource_group, storage_account):

self.cmd('az vm boot-diagnostics enable -g {rg} -n {name}')

with self.assertRaises(AzureConnectionError):
check_resource(self.cli_ctx, resource_group, name, None)
check_resource(self.cli_ctx, resource_group, name, None)

self.cmd('az vm deallocate -g {rg} -n {name}')

Expand All @@ -152,8 +148,7 @@ def test_check_resource_VM(self, resource_group, storage_account):
self.cmd('az vm start -g {rg} -n {name}')
self.cmd('az vm stop -g {rg} -n {name}')

with self.assertRaises(AzureConnectionError):
check_resource(self.cli_ctx, resource_group, name, None)
check_resource(self.cli_ctx, resource_group, name, None)

self.cmd('az vm boot-diagnostics disable -g {rg} -n {name}')

Expand Down
2 changes: 1 addition & 1 deletion src/serial-console/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 = '0.1.1'
VERSION = '0.1.2'

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