-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add OSMorphing Support for Amazon Linux
This patch adds Amazon Linux OS detection and core OSMorphing tools
- Loading branch information
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2023 Cloudbase Solutions Srl | ||
# All Rights Reserved. | ||
|
||
from coriolis.osmorphing import redhat | ||
from coriolis.osmorphing.osdetect import amazon as amazon_detect | ||
|
||
|
||
AMAZON_DISTRO_NAME_IDENTIFIER = amazon_detect.AMAZON_DISTRO_NAME | ||
|
||
|
||
class BaseAmazonLinuxOSMorphingTools(redhat.BaseRedHatMorphingTools): | ||
|
||
UEFI_GRUB_LOCATION = "/boot/efi/EFI/amzn" | ||
|
||
@classmethod | ||
def check_os_supported(cls, detected_os_info): | ||
if detected_os_info['distribution_name'] != ( | ||
AMAZON_DISTRO_NAME_IDENTIFIER): | ||
return False | ||
return cls._version_supported_util( | ||
detected_os_info['release_version'], minimum=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2023 Cloudbase Solutions Srl | ||
# All Rights Reserved. | ||
|
||
from coriolis import constants | ||
from coriolis.osmorphing.osdetect import base | ||
|
||
|
||
AMAZON_DISTRO_IDENTIFIER = "amzn" | ||
AMAZON_DISTRO_NAME = "Amazon Linux" | ||
|
||
|
||
class AmazonLinuxOSDetectTools(base.BaseLinuxOSDetectTools): | ||
|
||
def detect_os(self): | ||
info = {} | ||
os_release = self._get_os_release() | ||
osid = os_release.get("ID") | ||
osname = os_release.get("NAME") | ||
if osid == AMAZON_DISTRO_IDENTIFIER or osname == AMAZON_DISTRO_NAME: | ||
version = os_release.get("VERSION") | ||
friendly_name = "%s %s" % (AMAZON_DISTRO_NAME, version) | ||
info = { | ||
"os_type": constants.OS_TYPE_LINUX, | ||
"distribution_name": AMAZON_DISTRO_NAME, | ||
"release_version": version, | ||
"friendly_release_name": friendly_name} | ||
return info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters