diff --git a/XSConsoleDialogueBases.py b/XSConsoleDialogueBases.py index 0c2e384..932ea74 100644 --- a/XSConsoleDialogueBases.py +++ b/XSConsoleDialogueBases.py @@ -340,7 +340,12 @@ def UpdateFieldsCONFIRM(self): if self.Custom('mode') == 'rw': fileSize = ' ('+self.vdiMount.SizeString(self.filename, Lang('New file'))+')' else: - fileSize = ' ('+self.vdiMount.SizeString(self.filename, Lang('File not found'))+')' + if self.filename == '': + fileSize = Lang(' (No file specified)') + elif os.path.isdir(self.filename): + fileSize = Lang(' (Directory)') + else: + fileSize = ' ('+self.vdiMount.SizeString(self.filename, Lang('File not found'))+')' pane.AddWrappedBoldTextField(Lang("File")) pane.AddWrappedTextField(self.filename+fileSize) diff --git a/plugins-base/XSFeatureInstallLicence.py b/plugins-base/XSFeatureInstallLicence.py index 978808f..f7ff89c 100644 --- a/plugins-base/XSFeatureInstallLicence.py +++ b/plugins-base/XSFeatureInstallLicence.py @@ -42,6 +42,8 @@ def DoAction(self): filename = self.vdiMount.MountedPath(self.filename) FileUtils.AssertSafePath(filename) + if not os.path.isfile(filename): + raise Exception(Lang('Cannot read license file')) command = "/opt/xensource/bin/xe host-license-add license-file='"+filename+"' host-uuid="+hostRef status, output = commands.getstatusoutput(command)