Commit 01de9191 by Bodor Máté

Use connection dict to connect to the interface

parent ab579640
Pipeline #751 failed with stages
in 18 seconds
......@@ -3,18 +3,17 @@ from image.serializers import DiskSerializer
# from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
import openstack
from interface_openstack.implementation.image.openstack_image_manager import (
OpenstackImageManager,
)
import openstack
conn = openstack.connect(cloud="openstack")
from django.conf import settings
class DiskList(APIView):
def get(self, request, format=None):
# OpenStack
interface = OpenstackImageManager(conn)
interface = OpenstackImageManager(settings.CONNECTION)
return Response([disk.__dict__ for disk in interface.list()])
# Create response
......
......@@ -4,14 +4,11 @@ from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from interface_openstack.implementation.vm.instance import OSVirtualMachineManager
import openstack
import datetime
conn = openstack.connect(cloud="openstack")
from interface_openstack.implementation.vm.instance import OSVirtualMachineManager
from django.conf import settings
class InstanceList(APIView):
def get(self, request, format=None):
......@@ -20,7 +17,7 @@ class InstanceList(APIView):
def post(self, request, format=None):
data = request.data
interface = OSVirtualMachineManager(conn)
interface = OSVirtualMachineManager(settings.CONNECTION)
imageId = "da51253f-867c-472d-8ce0-81e7b7126d60"
flavorId = "1"
networks = [{"uuid": "c03d0d4b-413e-4cc6-9ebe-c0b5ca0dac3a"}]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment