Skip to content

Commit

Permalink
fix(vm): fix boot diagnistics option "no" caused an error
Browse files Browse the repository at this point in the history
  • Loading branch information
davidt99 committed Jul 23, 2020
1 parent abbd203 commit eaa400e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugins/modules/azure_rm_virtualmachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ def exec_module(self, **kwargs):
boot_diagnostics_storage_account = self.get_boot_diagnostics_storage_account(
limited=not self.boot_diagnostics['enabled'], vm_dict=vm_dict)
boot_diagnostics_blob = boot_diagnostics_storage_account.primary_endpoints.blob if boot_diagnostics_storage_account else None
if current_boot_diagnostics['storageUri'] != boot_diagnostics_blob:
if current_boot_diagnostics.get('storageUri') != boot_diagnostics_blob:
current_boot_diagnostics['storageUri'] = boot_diagnostics_blob
boot_diagnostics_changed = True

Expand Down Expand Up @@ -1363,10 +1363,14 @@ def exec_module(self, **kwargs):
vm_resource.os_profile.windows_configuration.win_rm = winrm

if self.boot_diagnostics_present:
if self.boot_diagnostics['enabled']:
storage_uri = boot_diag_storage_account.primary_endpoints.blob
else:
storage_uri = None
vm_resource.diagnostics_profile = self.compute_models.DiagnosticsProfile(
boot_diagnostics=self.compute_models.BootDiagnostics(
enabled=self.boot_diagnostics['enabled'],
storage_uri=boot_diag_storage_account.primary_endpoints.blob))
storage_uri=storage_uri))

if self.admin_password:
vm_resource.os_profile.admin_password = self.admin_password
Expand Down

0 comments on commit eaa400e

Please sign in to comment.