Skip to content

Commit

Permalink
Merge pull request #2052 from couchbase/feature/sgcollect_info_binary…
Browse files Browse the repository at this point in the history
…_locations

Fixes #2028 sg-collect-info can check in known places for Sync Gatewa…
  • Loading branch information
Andrew Reslan authored Aug 25, 2016
2 parents 945b963 + 20f40fe commit 25e68e8
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions tools/sgcollect_info
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,30 @@ def make_sg_tasks(zip_dir, sg_url, sync_gateway_config_path_option, sync_gateway

return sg_tasks

def discover_sg_binary_path(options, sg_url):

sg_bin_dirs = [
"/opt/couchbase-sync-gateway/bin/sync_gateway", # Linux + OSX
"/opt/couchbase-sg-accel/bin/sg_accel", # Linux + OSX
R'C:\Program Files (x86)\Couchbase\sync_gateway.exe', # Windows
R'C:\Program Files (x86)\Couchbase\sg_accel.exe', # Windows
]

for sg_binary_path_candidate in sg_bin_dirs:
if os.path.exists(sg_binary_path_candidate):
return sg_binary_path_candidate


sg_binary_path, _ = get_paths_from_expvars(sg_url)

if options.sync_gateway_executable is not None and len(options.sync_gateway_executable) > 0:
if not os.path.exists(options.sync_gateway_executable):
raise Exception(
"Path to sync gateway executable passed in does not exist: {}".format(options.sync_gateway_executable))
return sg_binary_path

# fallback to whatever was specified in options
return options.sync_gateway_executable

def main():

Expand Down Expand Up @@ -539,13 +563,8 @@ def main():
if options.verbosity:
log("Python version: %s" % sys.version)

# Collect the SG binary
sg_binary_path, _ = get_paths_from_expvars(sg_url)

if options.sync_gateway_executable is not None and len(options.sync_gateway_executable) > 0:
if not os.path.exists(options.sync_gateway_executable):
raise Exception("Path to sync gateway executable passed in does not exist: {}".format(options.sync_gateway_executable))
sg_binary_path = options.sync_gateway_executable
# Find path to sg binary
sg_binary_path = discover_sg_binary_path(options, sg_url)

# Run SG specific tasks
for task in make_sg_tasks(zip_dir, sg_url, options.sync_gateway_config, options.sync_gateway_executable):
Expand Down

0 comments on commit 25e68e8

Please sign in to comment.