@@ -63,6 +63,7 @@ def __init__(self, *args, **kwargs):
6363
6464
6565 self .config_section = "BOSCO"
66+ self .bosco_cluster = None
6667 self .log ("BoscoConfiguration.__init__ completed" )
6768
6869
@@ -181,7 +182,13 @@ def configure(self, attributes):
181182 return True
182183
183184 # Do all the things here!
184-
185+ self .bosco_cluster = shutil .which ("condor_remote_cluster" ) or shutil .which ("bosco_cluster" )
186+
187+ if not self .bosco_cluster and self .opt_val ("install_cluster" ) != "never" :
188+ self .log ("Cannot install remote cluster: neither condor_remote_cluster nor bosco_cluster were found" ,
189+ level = logging .ERROR )
190+ return False
191+
185192 # For each user, install bosco.
186193 for username in self .options ['users' ].value .split ("," ):
187194 username = username .strip ()
@@ -273,7 +280,7 @@ def result():
273280
274281 if self .opt_val ("install_cluster" ) == "if_needed" :
275282 # Only install if it's not in the clusterlist
276- cmd = [" bosco_cluster" , "-l" ]
283+ cmd = [self . bosco_cluster , "-l" ]
277284 process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE ,
278285 preexec_fn = demote (user_uid , user_gid ), env = env ,
279286 encoding = "latin-1" )
@@ -290,13 +297,13 @@ def result():
290297 self .log ("Entry found in clusterlist" , level = logging .DEBUG )
291298 return True
292299 else :
293- self .log ("bosco_cluster -l failed with unexpected exit code %d" % returncode , level = logging .ERROR )
300+ self .log ("%s failed with unexpected exit code %d" , " " . join ( cmd ), returncode , level = logging .ERROR )
294301 self .log ("stdout:\n %s" % stdout , level = logging .ERROR )
295302 self .log ("stderr:\n %s" % stderr , level = logging .ERROR )
296303 return False
297304
298305 # Run bosco cluster to install the remote cluster
299- install_cmd = [" bosco_cluster" ]
306+ install_cmd = [self . bosco_cluster ]
300307 override_dir = self .opt_val ('override_dir' )
301308 if override_dir :
302309 install_cmd += ['-o' , override_dir ]
0 commit comments