Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
There are prerequisites for building a xsconsole for XenServer.
All the following must be installed, either by visiting the
project webpage or installing a pre-built package provided by
project webpage or installing a pre-built package provided by
your OS distributor:
* RPM build
* Redhat rpm config (if debuginfo is required)
Expand Down Expand Up @@ -36,12 +36,12 @@ Follow these steps to build an RPM.
Move xsconsole.spec to /usr/src/redhat/SPECS/
Move xsconsole-plugins-oem.tar.bz2 to /usr/src/redhat/SOURCES/
Move xsconsole-plugins-oem.spec to /usr/src/redhat/SPECS/

5. To build the RPMs run:
cd /usr/src/redhat/SPECS/
rpmbuild -ba xsconsole.spec --target noarch
rpmbuild -ba xsconsole-plugins-oem.spec --target noarch

6. Install using
rpm -ivh /usr/src/redhat/RPMS/noarch/xsconsole*.rpm

2 changes: 1 addition & 1 deletion MaintenanceReadme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Very rarely this gives a pane height one line to short, probably because the ref

6. UpdateFields generally recreates fields from scratch, so you can't just call it whenever you like because, e.g. values in text entry fields will be lost and cursors reset. It's fine to update the root dialogue though.

7. It's tricky to get the ncurses display to refresh without flicker. Using the curses erase or clear methods on windows can lead to flickering redraws. Currently only scrolling in the right hand pane of the root dialogue has this problem. Since there's not much use of erase or clear the app does pretty minimal redraws, and things like spurious kernel message that scroll the screen can leave it in a mess for some time.
7. It's tricky to get the ncurses display to refresh without flicker. Using the curses erase or clear methods on windows can lead to flickering redraws. Currently only scrolling in the right hand pane of the root dialogue has this problem. Since there's not much use of erase or clear the app does pretty minimal redraws, and things like spurious kernel message that scroll the screen can leave it in a mess for some time.

8. MountVDI's Create VDB/Plug VBD/Mount VBD/Use VBD/Unmount VBD/Unplug VBD/Destroy VBD sequence failed when trying to mount empty CD drives. Now only MountVDIDirectly is used.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ What is this repository ?
This is the repository of XenServer-specific commits to the Xen project
xsconsole.

xsconsole is python based and provides and a ncurses GUI to get/set
xsconsole is python based and provides and a ncurses GUI to get/set
XenServer information from within a Domain0 console.

To contribute bug fixes, email them to the XenServer development mailing
Expand Down
4 changes: 2 additions & 2 deletions XSConsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def main():
app.Build( ['plugins-base', 'plugins-oem', 'plugins-extras'] )
try:
app.Enter()
except Exception, e:
except Exception as e:
# it may be that the screen size has changed
app.AssertScreenSize()
# if we get here then it was some other problem
Expand All @@ -44,7 +44,7 @@ def main():
if __name__ == "__main__":
try:
main()
except Exception, e:
except Exception as e:
# Add backtrace to log
try:
trace = traceback.format_tb(sys.exc_info()[2])
Expand Down
14 changes: 7 additions & 7 deletions XSConsoleAuth.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def PAMConv(inAuth, inQueryList, *theRest):
auth.authenticate()
auth.acct_mgmt()
# No exception implies a successful login
except Exception, e:
except Exception as e:
# Display a generic message for all failures
raise Exception(Lang("The system could not log you in. Please check your access credentials and try again."))

Expand Down Expand Up @@ -188,7 +188,7 @@ def OpenSession(self):
session = None
self.masterConnectionBroken = True
self.error = 'The master connection has timed out.'
except Exception, e:
except Exception as e:
session = None
self.error = e

Expand All @@ -198,15 +198,15 @@ def OpenSession(self):
try:
session.login_with_password('root', self.defaultPassword,'','XSConsole')

except XenAPI.Failure, e:
except XenAPI.Failure as e:
if e.details[0] != 'HOST_IS_SLAVE': # Ignore slave errors when testing
session = None
self.error = e
except socket.timeout:
session = None
self.masterConnectionBroken = True
self.error = 'The master connection has timed out.'
except Exception, e:
except Exception as e:
session = None
self.error = e
return session
Expand All @@ -218,7 +218,7 @@ def CloseSession(self, inSession):
if inSession._session is not None:
try:
inSession.logout()
except XenAPI.Failure, e:
except XenAPI.Failure as e:
XSLog('XAPI Failed to logout exception was ', e)
return None

Expand All @@ -241,7 +241,7 @@ def ChangePassword(self, inOldPassword, inNewPassword):
if self.IsPasswordSet():
try:
self.PAMAuthenticate('root', inOldPassword)
except Exception, e:
except Exception as e:
raise Exception(Lang('Old password not accepted. Please check your access credentials and try again.'))
self.AssertAuthenticated()

Expand All @@ -252,7 +252,7 @@ def ChangePassword(self, inOldPassword, inNewPassword):
session.xenapi.session.change_password(inOldPassword, inNewPassword)
finally:
self.CloseSession(session)
except Exception, e:
except Exception as e:
ShellPipe("/usr/bin/passwd", "--stdin", "root").Call(inNewPassword)
raise Exception(Lang("The underlying Xen API xapi could not be used. Password changed successfully on this host only."))

Expand Down
2 changes: 1 addition & 1 deletion XSConsoleBases.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ class Struct:
def __init__(self, *inArgs, **inKeywords):
for k, v in inKeywords.items():
setattr(self, k, v)

def __repr__(self):
return str(self.__dict__)
2 changes: 1 addition & 1 deletion XSConsoleCurses.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def ClippedAddStr(self, inString, inX, inY, inColour): # Internal use
self.win.addstr(inY, xPos, len(clippedStr)*' ', CursesPalette.ColourAttr(FirstValue(inColour, self.defaultColour)))
self.win.refresh()
self.win.addstr(inY, xPos, encodedStr, CursesPalette.ColourAttr(FirstValue(inColour, self.defaultColour)))
except Exception, e:
except Exception as e:
if xPos + len(inString) == self.xSize and inY + 1 == self.ySize:
# Curses incorrectly raises an exception when writing the bottom right
# character in a window, but still completes the write, so ignore it
Expand Down
10 changes: 5 additions & 5 deletions XSConsoleData.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def Update(self):
try:
try:
thisHost = self.session.xenapi.session.get_this_host(self.session._session)
except XenAPI.Failure, e:
except XenAPI.Failure as e:
XSLog('Data update connection failed - retrying. Exception was:', e)
self.session = Auth.Inst().CloseSession(self.session)
self.RequireSession()
Expand Down Expand Up @@ -203,7 +203,7 @@ def convertPIF(inPIF):

try:
retVal['network'] = self.session.xenapi.network.get_record(retVal['network'])
except XenAPI.Failure, e:
except XenAPI.Failure as e:
XSLogError('Missing network record: ', e)

retVal['opaqueref'] = inPIF
Expand Down Expand Up @@ -306,7 +306,7 @@ def update_SR_reference(inPool, retPool, key):

except socket.timeout:
self.session = None
except Exception, e:
except Exception as e:
XSLogError('Data update failed: ', e)

try:
Expand All @@ -326,7 +326,7 @@ def update_SR_reference(inPool, retPool, key):

self.data['sr'].append(values)

except Exception, e:
except Exception as e:
XSLogError('SR data update failed: ', e)

self.UpdateFromResolveConf()
Expand Down Expand Up @@ -1046,7 +1046,7 @@ def PurgeVBDs(self):
if vbd['currently_attached']:
self.UnplugVBD(vbd)
self.DestroyVBD(vbd)
except Exception, e:
except Exception as e:
XSLogError('VBD purge failed', e)

def IsXAPIRunning(self):
Expand Down
18 changes: 9 additions & 9 deletions XSConsoleDataUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def SizeString(cls, inSizeOrFilename, inDefault = None):
else:
retVal = str(int(fileSize))

except Exception, e:
except Exception as e:
retVal = FirstValue(inDefault, '')

return retVal
Expand Down Expand Up @@ -164,7 +164,7 @@ def USBFormat(self, inVDI):
try:
popenObj.wait() # Must wait for completion before mkfs
break
except IOError, e:
except IOError as e:
if e.errno != errno.EINTR: # Loop if EINTR
raise

Expand Down Expand Up @@ -241,17 +241,17 @@ def __init__(self, inVDI, inMode = None):
if status != 0:
try:
self.Unmount()
except Exception, e:
except Exception as e:
XSLogFailure('Device failed to unmount', e)
output += '\n'+self.mountDev
self.HandleMountFailure(output.split("\n"))

self.mountedVBD = True

except Exception, e:
except Exception as e:
try:
self.Unmount()
except Exception, e:
except Exception as e:
# Report the original exception, not this one
XSLogFailure('Device failed to unmount', e)
raise e
Expand Down Expand Up @@ -324,7 +324,7 @@ def Unmount(self):
time.sleep(5)
try:
self.vbd = Data.Inst().UnplugVBD(self.vbd)
except Exception, e:
except Exception as e:
XSLogFailure('Device failed to unmount', e)

self.pluggedVBD = False
Expand Down Expand Up @@ -364,17 +364,17 @@ def __init__(self, inVDI, inMode = None):
if status != 0:
try:
self.Unmount()
except Exception, e:
except Exception as e:
XSLogFailure('Device failed to unmount', e)
output += '\n'+self.mountDev
self.HandleMountFailure(status, output.split("\n"))

self.mountedVDI = True
XSLog('Mounted '+self.mountDev + ' on ' + self.mountPoint + ' mode ' + self.mode)
except Exception, e:
except Exception as e:
try:
self.Unmount()
except Exception, e:
except Exception as e:
XSLogFailure('Device failed to unmount', e)
raise e

Expand Down
16 changes: 8 additions & 8 deletions XSConsoleDialogueBases.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def HandleKey(self, inKey):
else:
Layout.Inst().PushDialogue(InfoDialogue( Lang('Login Successful')))

except Exception, e:
except Exception as e:
Layout.Inst().PushDialogue(InfoDialogue( Lang('Login Failed: ')+Lang(e)))

Data.Inst().Update()
Expand Down Expand Up @@ -401,7 +401,7 @@ def HandleKeyUSBNOTFORMATTED(self, inKey):
try:
FileUtils.USBFormat(self.vdi)
self.HandleDevice()
except Exception, e:
except Exception as e:
Layout.Inst().PushDialogue(InfoDialogue( Lang("Formatting Failed"), Lang(e)))

handled = True
Expand All @@ -425,7 +425,7 @@ def HandleKeyCUSTOM(self, inKey):
FileUtils.AssertSafeLeafname(inputValues['filename'])
self.filename = inputValues['filename']
self.ChangeState('CONFIRM')
except Exception, e:
except Exception as e:
Layout.Inst().PopDialogue()
Layout.Inst().PushDialogue(InfoDialogue(Lang(e)))
elif pane.CurrentInput().HandleKey(inKey):
Expand Down Expand Up @@ -477,7 +477,7 @@ def HandleDevice(self):
except USBNotMountable:
Layout.Inst().PopDialogue()
self.ChangeState('USBNOTMOUNTABLE')
except Exception, e:
except Exception as e:
try:
self.PreExitActions()
except Exception:
Expand Down Expand Up @@ -542,7 +542,7 @@ def HandleKey(self, inKey):
Layout.Inst().DoUpdate()
title, info = self.HandleCommit(self.Pane().GetFieldValues())
Layout.Inst().PushDialogue(InfoDialogue( title, info))
except Exception, e:
except Exception as e:
Layout.Inst().PushDialogue(InfoDialogue( Lang('Failed: ')+Lang(e)))
elif inKey == 'KEY_TAB':
pane.ActivateNextInput()
Expand Down Expand Up @@ -651,7 +651,7 @@ def UpdateFieldsINITIAL(self):
durationSecs = self.task.DurationSecs()
elapsedStr = TimeUtils.DurationString(durationSecs)

except Exception, e:
except Exception as e:
progressStr = Lang('<Unavailable>')
elapsedStr = Lang('<Unavailable>')

Expand All @@ -677,7 +677,7 @@ def UpdateFieldsCANCEL(self):
durationSecs = self.task.DurationSecs()
elapsedStr = TimeUtils.DurationString(durationSecs)

except Exception, e:
except Exception as e:
progressStr = Lang('<Unavailable>')
elapsedStr = Lang('<Unavailable>')

Expand All @@ -702,7 +702,7 @@ def UpdateFieldsCOMPLETE(self):
durationSecs = self.task.DurationSecs()
elapsedStr = TimeUtils.DurationString(durationSecs)

except Exception, e:
except Exception as e:
elapsedStr = Lang(e)

pane.AddWrappedTextField(Lang('Time', 16) + elapsedStr)
Expand Down
2 changes: 1 addition & 1 deletion XSConsoleHotData.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def GetData(self, inNames, inDefault, inRefs):
raise Exception("List index "+str(currentRef)+" out of range in '"+'.'.join(inNames)+"'")
itemRef = itemRef[currentRef]
return itemRef
except Exception, e:
except Exception as e:
# Data not present/fetchable, so return the default value
return FirstValue(inDefault, None)

Expand Down
2 changes: 1 addition & 1 deletion XSConsoleImporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def ImportAbsDir(cls, inDir):
# Import using variable as module name
(fileObj, pathName, description) = imp.find_module(importName, [root])
imp.load_module(importName, fileObj, pathName, description)
except Exception, e:
except Exception as e:
try: XSLogError(*traceback.format_tb(sys.exc_info()[2]))
except: pass
try: XSLogError("*** PlugIn '"+importName+"' failed to load: "+str(e))
Expand Down
6 changes: 3 additions & 3 deletions XSConsoleKeymaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ class Keymaps:
Lang("US International") : 'us-acentos',
Lang("US English") : 'us'
}

@classmethod
def NamesToMaps(cls):
return cls.namesToMaps


Loading