Skip to content

Commit

Permalink
Merge pull request #581 from radical-cybertools/fix/which_error
Browse files Browse the repository at this point in the history
raise error on missing tools
  • Loading branch information
Mark Santcroos authored Aug 11, 2016
2 parents d806e0f + addd619 commit e68f370
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/saga/utils/pty_shell_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,16 @@ def run_shell (self, info) :
return sh_slave


# --------------------------------------------------------------------------
#
def _which(self, cmd):

ret = ru.which(cmd)
if not ret:
raise RuntimeError('cmd %s not found' % cmd)
return ret


# --------------------------------------------------------------------------
#
def _create_master_entry (self, url, session, prompt, logger, posix,
Expand Down Expand Up @@ -498,17 +508,17 @@ def _create_master_entry (self, url, session, prompt, logger, posix,
info['shell_type'] = "ssh"
info['copy_mode'] = info['ssh_copy_mode']
info['share_mode'] = info['ssh_share_mode']
info['ssh_exe'] = ru.which ("ssh")
info['scp_exe'] = ru.which ("scp")
info['sftp_exe'] = ru.which ("sftp")
info['ssh_exe'] = self._which ("ssh")
info['scp_exe'] = self._which ("scp")
info['sftp_exe'] = self._which ("sftp")

elif info['schema'] in _SCHEMAS_GSI :
info['shell_type'] = "ssh"
info['copy_mode'] = info['ssh_copy_mode']
info['share_mode'] = info['ssh_share_mode']
info['ssh_exe'] = ru.which ("gsissh")
info['scp_exe'] = ru.which ("gsiscp")
info['sftp_exe'] = ru.which ("gsisftp")
info['ssh_exe'] = self._which ("gsissh")
info['scp_exe'] = self._which ("gsiscp")
info['sftp_exe'] = self._which ("gsisftp")

elif info['schema'] in _SCHEMAS_SH :
info['shell_type'] = "sh"
Expand All @@ -522,11 +532,11 @@ def _create_master_entry (self, url, session, prompt, logger, posix,
else : info['sh_args'] = ""

if "SHELL" in os.environ :
info['sh_exe'] = ru.which (os.environ["SHELL"])
info['cp_exe'] = ru.which ("cp")
info['sh_exe'] = self._which (os.environ["SHELL"])
info['cp_exe'] = self._which ("cp")
else :
info['sh_exe'] = ru.which ("sh")
info['cp_exe'] = ru.which ("cp")
info['sh_exe'] = self._which ("sh")
info['cp_exe'] = self._which ("cp")

else :
raise se.BadParameter._log (self.logger, \
Expand Down

0 comments on commit e68f370

Please sign in to comment.