hostname module: add support for Amazon Linux

pull/5090/head
dragon3 11 years ago
parent 52b2cfedfc
commit d39e6fda92

@ -122,8 +122,11 @@ def get_distribution():
if platform.system() == 'Linux': if platform.system() == 'Linux':
try: try:
distribution = platform.linux_distribution()[0].capitalize() distribution = platform.linux_distribution()[0].capitalize()
if distribution == 'NA': if not distribution and os.path.is_file('/etc/system-release'):
if os.path.is_file('/etc/system-release'): distribution = platform.linux_distribution(supported_dists=['system'])[0].capitalize()
if 'Amazon' in distribution:
distribution = 'Amazon'
else:
distribution = 'OtherLinux' distribution = 'OtherLinux'
except: except:
# FIXME: MethodMissing, I assume? # FIXME: MethodMissing, I assume?

@ -236,6 +236,11 @@ class CentOSHostname(Hostname):
distribution = 'Centos' distribution = 'Centos'
strategy_class = RedHatStrategy strategy_class = RedHatStrategy
class AmazonLinuxHostname(Hostname):
platform = 'Linux'
distribution = 'Amazon'
strategy_class = RedHatStrategy
# =========================================== # ===========================================
class FedoraStrategy(GenericStrategy): class FedoraStrategy(GenericStrategy):

Loading…
Cancel
Save