def test_create_ssh_askpass(self, mock_path): mock_path.dirname.return_value = 'file' mock_path.join.return_value = 'file/support/ssh_askpass' result = shell.create_ssh_askpass('pass', 'my_command') self.assertEqual( 'export SSH_ASKPASS=file/support/ssh_askpass;export PASS=pass;export DISPLAY=:0;setsid my_command', result)
def copy_ssfs_files(self, remote_host, primary_pass): """ Copy the ssfs data and key files to the secondary node Args: primary_pass: Password of the primary node """ user = self.HANAUSER.format(sid=self.sid) sid_upper = self.sid.upper() cmd = \ "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\ "{user}@{remote_host}:/usr/sap/{sid}/SYS/global/security/rsecssfs/data/SSFS_{sid}.DAT "\ "/usr/sap/{sid}/SYS/global/security/rsecssfs/data/SSFS_{sid}.DAT".format( user=user, remote_host=remote_host, sid=sid_upper) cmd = shell.create_ssh_askpass(primary_pass, cmd) self._run_hana_command(cmd) cmd = \ "scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null "\ "{user}@{remote_host}:/usr/sap/{sid}/SYS/global/security/rsecssfs/key/SSFS_{sid}.KEY "\ "/usr/sap/{sid}/SYS/global/security/rsecssfs/key/SSFS_{sid}.KEY".format( user=user, remote_host=remote_host, sid=sid_upper) cmd = shell.create_ssh_askpass(primary_pass, cmd) self._run_hana_command(cmd)