Skip to content

Commit

Permalink
Improve OS detection when VM has no osProfile (#197)
Browse files Browse the repository at this point in the history
We have VM without OS profile (checked on https://resources.azure.com/) and they appear as "unknown" os :-/

This appear to be a known issue: https://support.microsoft.com/en-ph/help/4018140/computer-names-of-specialized-virtual-machines-are-missing-or-blank-in

Co-authored-by: Fred-sun <37327967+Fred-sun@users.noreply.github.com>
Co-authored-by: haiyuan_zhang <haiyuan.zhang1982@gmail.com>
  • Loading branch information
3 people committed Aug 24, 2020
1 parent 6188c38 commit ed3d0d3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions plugins/inventory/azure_rm.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,12 @@ def hostvars(self):
system = 'linux'
if 'windowsConfiguration' in self._vm_model['properties']['osProfile']:
system = 'windows'
else:
osType = self._vm_model['properties']['storageProfile']['osDisk']['osType']
if osType == 'Linux':
system = 'linux'
if osType == 'Windows':
system = 'windows'

new_hostvars = dict(
public_ipv4_addresses=[],
Expand Down

0 comments on commit ed3d0d3

Please sign in to comment.