示例#1
0
    def domain_delete(self, inst):

        if not inst.config:
            inst.init_config()

        config = json.loads(inst.config)
        if 'domain' in config.keys():
            del config['domain']

        # TODO: delete nginx binding
        from tool.domain import unbinding_domain_from_nginx
        ret, reason = unbinding_domain_from_nginx(self.db2, inst.id)
        if not ret:
            return  False, _('unbinding domain error: %s') % reason

        inst.config = json.dumps( config )
        self.db2.commit()

        return True, _('Success!')
示例#2
0
    def domain_delete(self, inst):

        if not inst.config:
            inst.init_config()

        config = json.loads(inst.config)
        if 'domain' in config.keys():
            del config['domain']

        # TODO: delete nginx binding
        from tool.domain import unbinding_domain_from_nginx
        ret, reason = unbinding_domain_from_nginx(self.db2, inst.id)
        if not ret:
            return  False, _('unbinding domain error: %s') % reason

        inst.config = json.dumps( config )
        self.db2.commit()

        return True, _('Success!')
示例#3
0
    def domain_delete(self, inst):

        if not inst.config:
            inst.init_config()

        config = json.loads(inst.config)
        domain = config.get('domain', {})
        if not (domain and domain.get('name')):
            return True, self.trans(_('No domain needed unbinding!'))

        # TODO: delete nginx binding
        from tool.domain import unbinding_domain_from_nginx
        ret, reason = unbinding_domain_from_nginx(self.db2, inst.id)
        if not ret:
            return  False, self.trans(_('unbinding domain error: %s')) % reason

        del config['domain']
        inst.config = json.dumps( config )
        self.db2.commit()

        return True, self.trans(_('Success!'))
示例#4
0
    def domain_delete(self, inst):

        if not inst.config:
            inst.init_config()

        config = json.loads(inst.config)
        domain = config.get('domain', {})
        if not (domain and domain.get('name')):
            return True, self.trans(_('No domain needed unbinding!'))

        # TODO: delete nginx binding
        from tool.domain import unbinding_domain_from_nginx
        ret, reason = unbinding_domain_from_nginx(self.db2, inst.id)
        if not ret:
            return False, self.trans(_('unbinding domain error: %s')) % reason

        del config['domain']
        inst.config = json.dumps(config)
        self.db2.commit()

        return True, self.trans(_('Success!'))