예제 #1
0
def delete_network(request, network_id):
    log.info('delete_network %s', network_id)
    network = util.get_network(network_id, request.user_uniq, for_update=True)
    if network.public:
        raise api.faults.Forbidden("Cannot delete the public network.")
    networks.delete(network)
    return HttpResponse(status=204)
예제 #2
0
def delete_network(request, network_id):
    log.info('delete_network %s', network_id)
    network = util.get_network(network_id, request.user_uniq, for_update=True)
    if network.public:
        raise api.faults.Forbidden("Cannot delete the public network.")
    networks.delete(network)
    return HttpResponse(status=204)
예제 #3
0
def delete_network(request, network_id):
    credentials = request.credentials
    log.debug("User: %s, Network: %s, Action: delete", credentials.userid,
              network_id)

    networks.delete(network_id, credentials)

    log.info("User %s deleted network %s", credentials.userid, network_id)

    return HttpResponse(status=204)
예제 #4
0
파일: networks.py 프로젝트: grnet/synnefo
def delete_network(request, network_id):
    credentials = request.credentials
    log.debug("User: %s, Network: %s, Action: delete", credentials.userid,
              network_id)

    networks.delete(network_id, credentials)

    log.info("User %s deleted network %s", credentials.userid, network_id)

    return HttpResponse(status=204)
예제 #5
0
def delete_network(request, network_id):
    network = util.get_network(network_id,
                               request.user_uniq,
                               request.user_projects,
                               for_update=True,
                               non_deleted=True)
    if network.public:
        raise api.faults.Forbidden("Cannot delete the public network.")

    log.debug("User: %s, Network: %s, Action: delete", request.user_uniq,
              network.id)

    networks.delete(network)

    log.info("User %s deleted network %s", request.user_uniq, network.id)

    return HttpResponse(status=204)
예제 #6
0
    def handle(self, *args, **options):
        if not args:
            raise CommandError("Please provide a network ID")

        force = options["force"]
        message = "networks" if len(args) > 1 else "network"
        self.confirm_deletion(force, message, args)

        for network_id in args:
            self.stdout.write("\n")
            try:
                network = common.get_resource("network", network_id, for_update=True)
                self.stdout.write("Removing network: %s\n" % network.backend_id)

                networks.delete(network)

                self.stdout.write("Successfully submitted Ganeti jobs to" " remove network %s\n" % network.backend_id)
            except (CommandError, faults.BadRequest) as e:
                self.stdout.write("Error -- %s\n" % e.message)
예제 #7
0
    def handle(self, *args, **options):
        if not args:
            raise CommandError("Please provide a network ID")

        force = options['force']
        message = "networks" if len(args) > 1 else "network"
        self.confirm_deletion(force, message, args)

        for network_id in args:
            self.stdout.write("\n")
            try:
                network = get_network(network_id, for_update=True)
                self.stdout.write('Removing network: %s\n' %
                                  network.backend_id)

                networks.delete(network)

                self.stdout.write("Successfully submitted Ganeti jobs to"
                                  " remove network %s\n" % network.backend_id)
            except (CommandError, faults.BadRequest) as e:
                self.stdout.write("Error -- %s\n" % e.message)