mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-10 10:51:03 +00:00
Fix get_distribution for Alpine Linux (#17224)
To override a generic class that is subclassed based on platform, the subclass must define platform and distribution. The load_platform_subclass() calls the get_platform() and get_distribution() methods to detect the platform and the distribution. On Alpine Linux, get_distribution() method returns None and it is not possible to have different implementations based on detected platform.
This commit is contained in:
committed by
Matt Davis
parent
3ab9dddb3a
commit
8fd3935029
@@ -218,7 +218,7 @@ def get_distribution():
|
||||
''' return the distribution name '''
|
||||
if platform.system() == 'Linux':
|
||||
try:
|
||||
supported_dists = platform._supported_dists + ('arch',)
|
||||
supported_dists = platform._supported_dists + ('arch','alpine')
|
||||
distribution = platform.linux_distribution(supported_dists=supported_dists)[0].capitalize()
|
||||
if not distribution and os.path.isfile('/etc/system-release'):
|
||||
distribution = platform.linux_distribution(supported_dists=['system'])[0].capitalize()
|
||||
|
||||
Reference in New Issue
Block a user