Browse files

setup.py: Fixed a bug where the wrong init script was being installed…

… on Red Hat and Gentoo systems.

INSTALL.txt:  Added instructions on how to make Gate One start at boot on Debian/Ubuntu, Red Hat/CentOS, and Gentoo.
gateone.js:  Fixed a bug where if you clicked on a toolbar icon more than once while a panel was still being drawn/hidden it could get stuck in a state where it would hide the panel every time you tried to toggle it open.
SSH Plugin:  Fixed a bug in ssh.js where execRemoteCmd() wasn't calling errorback functions when the WebSocket was disconnected.
SSH Plugin:  When opening a sub-channel fails, execute_command() will now attempt to send a message to the client indicating as such (as opposed to just silently failing).
SSH Plugin:  Added a little check to open_sub_channel() to ensure that the user's session directory exists before it tries to look inside it for an existing control socket.  This situation could happen if you restarted Gate One and a client tried to execRemoteCmd() before they had completed the authentication process (which creates their session dir).
  • Loading branch information...
1 parent a5186bc commit fed1175bb74b51461ddf3a606287e1c23e0b9b4b @liftoff committed Sep 24, 2012
Showing with 42 additions and 7 deletions.
  1. +6 −0 INSTALL.txt
  2. +16 −0 gateone/plugins/ssh/ssh.py
  3. +7 −3 gateone/plugins/ssh/static/ssh.js
  4. +10 −1 gateone/static/gateone.js
  5. +1 −1 scripts/init/gateone-redhat.sh
  6. +2 −2 setup.py
View
6 INSTALL.txt
@@ -23,3 +23,9 @@ can usually install it with one of the following commands on most distros:
sudo pip install stdeb
...or:
sudo easy_install stdeb
+
+To make Gate One start on boot:
+
+ Ubuntu/Debian: update-rc.d gateone defaults
+ Red Hat/CentOS: chkconfig --add gateone
+ Gentoo: rc-update add gateone default
View
16 gateone/plugins/ssh/ssh.py
@@ -133,6 +133,9 @@ def open_sub_channel(term, tws):
session = tws.session
session_dir = tws.settings['session_dir']
session_path = os.path.join(session_dir, session)
+ if not session_path:
+ raise SSHMultiplexingException(_(
+ "SSH Plugin: Unable to open slave sub-channel."))
socket_path = None
# Find the SSH socket path...
for f in os.listdir(session_path):
@@ -285,6 +288,19 @@ def execute_command(term, cmd, callback=None, tws=None):
logging.error(_(
"%s: Got an error trying to open sub-channel on term %s..." %
(tws.get_current_user()['upn'], term)))
+ # Try to send an error response to the client
+ message = {
+ 'sshjs_cmd_output': {
+ 'term': term,
+ 'cmd': cmd,
+ 'output': None,
+ 'result': str(e)
+ }
+ }
+ try:
+ tws.write_message(message)
+ except: # This is really just a last-ditch thing
+ pass
return
# NOTE: We can assume the IOLoop is started and automatically calling read()
m.unexpect() # Clear out any existing patterns (if existing sub-channel)
View
10 gateone/plugins/ssh/static/ssh.js
@@ -1083,7 +1083,7 @@ GateOne.Base.update(GateOne.SSH, {
output = message['output'],
result = message['result'];
if (result != 'Success') {
- go.Visual.displayMessage("Error executing background command on terminal " + term + ": " + result);
+ go.Visual.displayMessage("Error executing background command, '" + cmd + "' on terminal " + term + ": " + result);
if (go.SSH.remoteCmdErrorbacks[term][cmd]) {
go.SSH.remoteCmdErrorbacks[term][cmd](result);
delete go.SSH.remoteCmdErrorbacks[term][cmd];
@@ -1093,7 +1093,7 @@ GateOne.Base.update(GateOne.SSH, {
if (go.SSH.remoteCmdCallbacks[term][cmd]) {
go.SSH.remoteCmdCallbacks[term][cmd](output);
delete go.SSH.remoteCmdCallbacks[term][cmd];
- } else {
+ } else { // If you don't have an associated callback it will display and log the output: VERY useful in debugging!
go.Visual.displayMessage("Remote command output from terminal " + term + ": " + output);
}
},
@@ -1113,7 +1113,11 @@ GateOne.Base.update(GateOne.SSH, {
ssh.remoteCmdCallbacks[term][command] = callback;
// Set the errorback for *term*
ssh.remoteCmdErrorbacks[term][command] = errorback;
- go.ws.send(JSON.stringify({'ssh_execute_command': {'term': term, 'cmd': command}}));
+ if (go.ws.readyState != 1) {
+ ssh.commandCompleted({'term': term, 'cmd': command, 'result': 'WebSocket is disconnected.'});
+ } else {
+ go.ws.send(JSON.stringify({'ssh_execute_command': {'term': term, 'cmd': command}}));
+ }
}
});
View
11 gateone/static/gateone.js
@@ -2576,6 +2576,7 @@ GateOne.Visual.panelToggleCallbacks = {'in': {}, 'out': {}};
GateOne.Visual.lastMessage = '';
GateOne.Visual.sinceLastMessage = new Date();
GateOne.Visual.hidePanelsTimeout = {}; // Used by togglePanel() to keep track of which panels have timeouts
+GateOne.Visual.togglingPanel = false;
GateOne.Base.update(GateOne.Visual, {
// Functions for manipulating views and displaying things
init: function() {
@@ -2720,6 +2721,11 @@ GateOne.Base.update(GateOne.Visual, {
v.hidePanelsTimeout[panel.id] = null;
}, 1250);
}
+ if (v.togglingPanel) {
+ return; // Don't let the user muck with the toggle until everything has run its course
+ } else {
+ v.togglingPanel = true;
+ }
if (panel) {
origState = v.getTransform(panel);
}
@@ -2741,6 +2747,7 @@ GateOne.Base.update(GateOne.Visual, {
}
if (!panel) {
// All done
+ v.togglingPanel = false;
return;
}
if (origState != 'scale(1)') {
@@ -2768,6 +2775,7 @@ GateOne.Base.update(GateOne.Visual, {
return false;
}
}
+ v.togglingPanel = false;
} else {
// Send it away
v.applyTransform(panel, 'scale(0)');
@@ -2784,7 +2792,8 @@ GateOne.Base.update(GateOne.Visual, {
setTimeout(function() {
// Hide the panel completely now that it has been scaled out to avoid tabIndex issues
u.hideElement(panel);
- }, 1250);
+ v.togglingPanel = false;
+ }, 1100);
}
},
displayTermInfo: function(term) {
View
2 scripts/init/gateone-redhat.sh
@@ -2,7 +2,7 @@
#
# gateone Start/Stop Gate One.
#
-# chkconfig: - 2345 55 25
+# chkconfig: 2345 55 25
# description: Gate One is a web-based terminal emulator and SSH client.
#
# processname: gateone.py
View
4 setup.py
@@ -107,9 +107,9 @@ def walk_data_files(path, install_path=prefix):
if os.path.exists('/etc/debian_version'):
shutil.copy(debian_script, temp_script_path)
elif os.path.exists('/etc/redhat-release'):
- shutil.copy(debian_script, temp_script_path)
+ shutil.copy(redhat_script, temp_script_path)
elif os.path.exists('/etc/gentoo-release'):
- shutil.copy(debian_script, temp_script_path)
+ shutil.copy(gentoo_script, temp_script_path)
conf_file = [('/etc/conf.d', [
os.path.join(setup_dir, 'scripts/conf/gateone')
])]

0 comments on commit fed1175

Please sign in to comment.