aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Sokolovsky <paul.sokolovsky@linaro.org>2014-12-03 21:59:11 +0200
committerPaul Sokolovsky <paul.sokolovsky@linaro.org>2014-12-03 21:59:11 +0200
commit2954acbfcc53c716c72e5974d2fd91a0c1aad782 (patch)
tree3195a644f7e087036c3d1ff96c89b7d64ab82652
parent087fcf465cf34daad5264b13b5a26b2f102fc88d (diff)
downloadlinaro-android-build-tools-2954acbfcc53c716c72e5974d2fd91a0c1aad782.tar.gz
prepare_build_config.py: Use reliable (external) way to check for EC2.
Previously, there was a test where to put file being created based on this file existing. Change-Id: I3cfcd610426c1713eaeb0f07979a6337fea79780
-rwxr-xr-xnode/prepare_build_config.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/node/prepare_build_config.py b/node/prepare_build_config.py
index dfcde19..9fdee1c 100755
--- a/node/prepare_build_config.py
+++ b/node/prepare_build_config.py
@@ -30,11 +30,13 @@ def shell_unquote(s):
return s[1:-1]
return s
+def is_on_ec2():
+ return os.path.exists("/etc/cloud/cloud.cfg")
def get_slave_type():
slave_type = ""
try:
- if os.path.exists(SLAVE_TYPE_FILE_EC2):
+ if is_on_ec2():
f = open(SLAVE_TYPE_FILE_EC2)
else:
f = open(SLAVE_TYPE_FILE_VPS)
@@ -106,7 +108,7 @@ def convert_config_to_shell(config_text, out_filename):
def main(config_in, is_base64):
if is_base64:
config_in = base64.b64decode(config_in)
- if os.path.exists(BUILD_CONFIG_FILE_EC2):
+ if is_on_ec2():
BUILD_CONFIG_FILE=BUILD_CONFIG_FILE_EC2
else:
BUILD_CONFIG_FILE=BUILD_CONFIG_FILE_VPS