Exemplo n.º 1
0
def add_host(context, request):
    host = Host()
    host.hostname = request.params.get('hostname', '')
    host.cdn = request.params.get('cdn', '')
    host.ssl = request.params.get('ssl', True)

    host.save(force_insert=True)
    request.reply()
Exemplo n.º 2
0
def add_host(context, request):
    host = Host()
    host.hostname = request.params.get('hostname', '')
    host.cdn = request.params.get('cdn', '')
    host.ssl = request.params.get('ssl', True)

    host.save(force_insert=True)
    request.reply()
Exemplo n.º 3
0
    def _get_or_bootstrap_host(self, hostname):
        try:
            return Host.get(Host.hostname == hostname)
        except DoesNotExist:
            try:
                host_data = self.bootstrapper.lookup_host(hostname)
            except BootstrapError:
                raise DoesNotExist

            host = Host(**host_data)

            try:
                host.cdn = self._get_or_bootstrap_cdn(host.cdn_id)
            except DoesNotExist:
                host.cdn = CDN.create(id=host.cdn_id, valid=False)

            host.save(force_insert=True)

            return host