aboutsummaryrefslogtreecommitdiff
path: root/node/prepare_build_config.py
diff options
context:
space:
mode:
Diffstat (limited to 'node/prepare_build_config.py')
-rwxr-xr-xnode/prepare_build_config.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/node/prepare_build_config.py b/node/prepare_build_config.py
index 4ad5de2..dfcde19 100755
--- a/node/prepare_build_config.py
+++ b/node/prepare_build_config.py
@@ -6,11 +6,13 @@ import re
import pipes
import optparse
-
-SLAVE_TYPE_FILE = "/var/run/build-tools/slave-type"
-SLAVE_TYPE_RESTRICTED = "restricted builds"
+SLAVE_TYPE_FILE_EC2 = "/var/run/build-tools/slave-type"
+# sf-safe build config is written to this file
+BUILD_CONFIG_FILE_EC2 = "/var/run/build-tools/build-config"
+SLAVE_TYPE_FILE_VPS = "/tmp/build-tools/slave-type"
# sf-safe build config is written to this file
-BUILD_CONFIG_FILE = "/var/run/build-tools/build-config"
+BUILD_CONFIG_FILE_VPS = "/tmp/build-tools/build-config"
+SLAVE_TYPE_RESTRICTED = "restricted builds"
class BuildConfigMismatchException(Exception):
@@ -32,7 +34,10 @@ def shell_unquote(s):
def get_slave_type():
slave_type = ""
try:
- f = open(SLAVE_TYPE_FILE)
+ if os.path.exists(SLAVE_TYPE_FILE_EC2):
+ f = open(SLAVE_TYPE_FILE_EC2)
+ else:
+ f = open(SLAVE_TYPE_FILE_VPS)
slave_type = f.read().rstrip()
f.close()
except:
@@ -101,6 +106,10 @@ 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):
+ BUILD_CONFIG_FILE=BUILD_CONFIG_FILE_EC2
+ else:
+ BUILD_CONFIG_FILE=BUILD_CONFIG_FILE_VPS
config = convert_config_to_shell(config_in, BUILD_CONFIG_FILE)
try:
validate_config(config, get_slave_type())