class AppCenterError(Exception): '''A "real" exception that developers cannot handle very well. The difference between AppCenterError and Abort is that Abort is a somewhat defined behavior, i.e. App installation has to fail if the setup script fails. AppCenterError happens where it was not supposed to. The difference between AppCenterError and Exception is that AppCenterError gives a nicer feedback for the Administrator than a scary traceback. You can even put custom information into the proposed feedback mail (raise AppCenterError(str(custom))). As with Abort, AppCenterError should be subclassed and get a different code.''' code = 500 title = _('An error occurred!') info = _('We are sorry for the inconvenience. Please help us to improve the App Center and the Apps by sending us the information below.')
def __init__(self, app_name): reason_en_US = 'Manifest checksum mismatch' reason_message = _('Manifest checksum mismatch') _logger.error(reason_en_US) super(DockerImageVerificationFailedChecksum, self).__init__(reason_message)
def test_install(self, app): supported_architectures = app.supported_architectures platform_bits = platform.architecture()[0] aliases = {'i386': '32bit', 'amd64': '64bit'} if supported_architectures: for architecture in supported_architectures: if aliases[architecture] == platform_bits: break else: # For now only two architectures are supported: # 32bit and 64bit - and this will probably not change # too soon. # So instead of returning lists and whatnot # just return a nice message # Needs to be adapted when supporting different archs supported = supported_architectures[0] if supported == 'i386': needs = 32 has = 64 else: needs = 64 has = 32 msg = _( 'The application needs a %(needs)s-bit operating system. This server is running a %(has)s-bit operating system.' ) % { 'needs': needs, 'has': has } return {'supported': supported, 'msg': msg}
def __init__(self, app_name, docker_image_manifest_url): reason_en_US = 'Error while contacting Docker registry server %s' % ( docker_image_manifest_url, ) reason_message = _('Error while contacting Docker registry server %s' ) % (docker_image_manifest_url, ) _logger.error(reason_en_US) super(DockerImageVerificationFailedRegistryContact, self).__init__(reason_message)
def __str__(self): msg = _('LDAP connection refused. There may be an issue with the certificate of the LDAP server. Please also check the proxy and firewall settings, if any.') details = None try: details = self.details.get('info', 'No further details') except (IndexError, KeyError): pass if details: msg += ' (' + details + ')' return msg
def _setup_docker_image(self, app, args): self._execute_container_script(app, 'restore_data_before_setup', _credentials=False) if app.docker_script_setup: process = self._execute_container_script(app, 'setup', args) if not process or process.returncode != 0: raise Abort(_('Setup script failed!')) self._execute_container_script(app, 'restore_data_after_setup', _credentials=False)
class PasswordSetting(Setting): description = IniSectionAttribute(default=_('Password'), localisable=True) def _log_set_value(self, app, value): # do not log password pass
class ResidualInstallationError(AppCenterError): code = 502 title = _('An unexpected error occured before the installation started!')
class AppCenterErrorContainerStart(AppCenterError): code = 501 title = _('The docker container could not be started!')
class AppCenterError(Exception): code = 500 title = _('An error occurred!') info = _( 'We are sorry for the inconvenience. Please help us to improve the AppCenter and the Apps by sending us the information below.' )