Skip to content

Commit

Permalink
Vm repair (#6864)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwuae1 authored Oct 25, 2023
1 parent 0ce2e5b commit 87bb99e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 30 deletions.
4 changes: 4 additions & 0 deletions src/vm-repair/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@

Release History
===============
0.5.7
++++++
Remove VM-repair SUSE image check

0.5.6
++++++
Renaming the Public IP resource.
Expand Down
33 changes: 4 additions & 29 deletions src/vm-repair/azext_vm_repair/repair_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,31 +489,6 @@ def _fetch_compatible_windows_os_urn(source_vm):
return urns[0]


def _suse_image_selector(distro):
fetch_urn_command = 'az vm image list --publisher SUSE --offer {offer} --sku gen1 --verbose --all --query "[].urn | reverse(sort(@))" -o json'.format(offer=distro)
urns = loads(_call_az_command(fetch_urn_command))

# Raise exception when not finding SUSE image
if not urns:
raise SuseNotAvailableError()

return urns[0]


def _suse_image_selector_gen2(distro):
fetch_urn_command = 'az vm image list --publisher SUSE --offer {offer} --sku gen2 --verbose --all --query "[].urn | reverse(sort(@))" -o json'.format(offer=distro)
urns = loads(_call_az_command(fetch_urn_command))

# Raise exception when not finding SUSE image
if not urns:
raise SuseNotAvailableError()

logger.debug('Fetched urns: \n%s', urns)
# Returning the first URN as it is the latest image with no special use like HPC or SAP
logger.debug('Return the first URN : %s', urns[0])
return urns[0]


def _select_distro_linux(distro):
image_lookup = {
'rhel6': 'RedHat:RHEL:6.10:latest',
Expand All @@ -527,8 +502,8 @@ def _select_distro_linux(distro):
'oracle6': 'Oracle:Oracle-Linux:6.10:latest',
'oracle7': 'Oracle:Oracle-Linux:ol79:latest',
'oracle8': 'Oracle:Oracle-Linux:ol82:latest',
'sles12': _suse_image_selector('sles-12'),
'sles15': _suse_image_selector('sles-15')
'sles12': 'SUSE:sles-12-sp5:gen1:latest',
'sles15': 'SUSE:sles-15-sp3:gen1:latest',
}
if distro in image_lookup:
os_image_urn = image_lookup[distro]
Expand Down Expand Up @@ -576,8 +551,8 @@ def _select_distro_linux_gen2(distro):
'oracle6': 'Oracle:Oracle-Linux:ol79-gen2:latest',
'oracle7': 'Oracle:Oracle-Linux:ol79-gen2:latest',
'oracle8': 'Oracle:Oracle-Linux:ol82-gen2:latest',
'sles12': _suse_image_selector_gen2('sles-12'),
'sles15': _suse_image_selector_gen2('sles-15')
'sles12': 'SUSE:sles-12-sp5:gen2:latest',
'sles15': 'SUSE:sles-15-sp3:gen2:latest',
}
if distro in image_lookup:
os_image_urn = image_lookup[distro]
Expand Down
2 changes: 1 addition & 1 deletion src/vm-repair/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from codecs import open
from setuptools import setup, find_packages

VERSION = "0.5.6"
VERSION = "0.5.7"

CLASSIFIERS = [
'Development Status :: 4 - Beta',
Expand Down

0 comments on commit 87bb99e

Please sign in to comment.