← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~praween/cloud-init:amazon-distro into cloud-init:master

 

Praveen Paladugu has proposed merging ~praween/cloud-init:amazon-distro into cloud-init:master.

Commit message:
Properly detect Amazon Linux 2 while configuring USR_LIB_EXEC

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~praween/cloud-init/+git/cloud-init/+merge/353733
-- 
Your team cloud-init commiters is requested to review the proposed merge of ~praween/cloud-init:amazon-distro into cloud-init:master.
diff --git a/setup.py b/setup.py
index 5ed8eae..25019f0 100755
--- a/setup.py
+++ b/setup.py
@@ -23,6 +23,7 @@ from setuptools.command.egg_info import egg_info
 from distutils.errors import DistutilsArgError
 
 import subprocess
+import re
 
 RENDERED_TMPD_PREFIX = "RENDERED_TEMPD"
 VARIANT = None
@@ -167,7 +168,13 @@ if os.uname()[0] == 'FreeBSD':
     USR_LIB_EXEC = "usr/local/lib"
 elif os.path.isfile('/etc/redhat-release'):
     USR_LIB_EXEC = "usr/libexec"
+elif os.path.isfile('/etc/system-release-cpe'):
+    with open('/etc/system-release-cpe') as f:
+        cpe_data = f.read()
 
+    if re.match("^cpe.*amazon_linux:2[\s]$", cpe_data):
+        # Amazon Linux 2
+        USR_LIB_EXEC = "usr/libexec"
 
 class MyEggInfo(egg_info):
     """This makes sure to not include the rendered files in SOURCES.txt."""

Follow ups