Skip to content

Commit

Permalink
aem: fix a bug on detecting linux os type (#51)
Browse files Browse the repository at this point in the history
* fix a bug on detecting linux os type

* fix lint
  • Loading branch information
yugangw-msft authored Feb 8, 2018
1 parent b6f6b0a commit b1a5c51
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/aem/azext_aem/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ def __init__(self, cmd, resource_group, vm_name, vm_client,
self._resource_group = resource_group
self._cmd = cmd
self._vm = vm_client.virtual_machines.get(resource_group, vm_name, expand='instanceView')
self._extension = (aem_extension_info['Linux'] if bool(self._vm.os_profile.linux_configuration)
else aem_extension_info['Windows'])
os_type = self._vm.storage_profile.os_disk.os_type.value.lower()
self._extension = aem_extension_info['Linux'] if (os_type == 'linux') else aem_extension_info['Windows']
self._skip_storage_analytics = skip_storage_analytics

def enable(self):
Expand Down Expand Up @@ -268,10 +268,10 @@ def _build_extension_cfgs(self, disk_info):

def _get_aem_extension(self):
existing_ext = None
if self._vm.instance_view.extensions:
full_type_name = '.'.join([self._extension['publisher'], self._extension['name']])
existing_ext = next((x for x in self._vm.instance_view.extensions
if x.type and (x.type.lower() == full_type_name.lower())), None)
if self._vm.resources:
existing_ext = next((x for x in self._vm.resources
if x.virtual_machine_extension_type.lower() == self._extension['name'].lower() and
x.publisher.lower() == self._extension['publisher'].lower()), None)
return existing_ext

def _get_disk_info(self):
Expand Down

0 comments on commit b1a5c51

Please sign in to comment.