Skip to content

Commit

Permalink
[SerialConsole] Change to require custom boot diagnostics (#3737)
Browse files Browse the repository at this point in the history
* Added custom boot diagnostics check

* Updated test recordings
  • Loading branch information
adrianabedon authored Aug 4, 2021
1 parent 9693e2e commit 7db0d06
Show file tree
Hide file tree
Showing 7 changed files with 2,351 additions and 1,405 deletions.
6 changes: 4 additions & 2 deletions src/serial-console/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
.. :changelog:
Release History
===============

0.1.1
++++++
* Change to require custom boot diagnostics

0.1.0
++++++
* Initial release.
28 changes: 18 additions & 10 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:
error_message = ("Azure Serial Console requires boot diagnostics to be enabled.")
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.")
recommendation = ('Use "az vmss update --name MyScaleSet --resource-group MyResourceGroup --set '
'virtualMachineProfile.diagnosticsProfile="{\\"bootDiagnostics\\": {\\"Enabled\\" : '
'\\"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 *".')
'\\"True\\",\\"StorageUri\\":\\"https://mystorageacct.blob.core.windows.net/\\"}}""'
'to enable boot diagnostics.')
raise AzureConnectionError(
error_message, recommendation=recommendation)
else:
Expand Down Expand Up @@ -640,13 +640,21 @@ 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.")
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/".')
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.")
raise AzureConnectionError(
error_message, recommendation=recommendation)

Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 7db0d06

Please sign in to comment.