Commit 380211d5 by Bodor Máté

Merge branch 'CI' into 'DEV'

Ci

See merge request !6
parents 9d58ef3b 7fce75ec
Pipeline #763 failed with stages
in 16 seconds
......@@ -5,3 +5,4 @@ recircle/clouds.yaml
recircle/implementation/
recircle/interface/
recircle/interface_openstack/
environment.sh
\ No newline at end of file
image: python:3.6
stages:
- lint
- test
flake8:
before_script:
- pip install flake8
stage: lint
script:
- flake8 --max-line-length=125 --exclude=migrations
test:
before_script:
- pip install pipenv
- pipenv install -d
- git submodule sync --recursive
- git submodule update --init --recursive
script:
- cd recircle
- pipenv run python manage.py test
[submodule "recircle/interface_openstack"]
path = recircle/interface_openstack
url = https://git.ik.bme.hu/RECIRCLE/interface-openstack
url = ../../RECIRCLE/interface-openstack
branch = DEV
......@@ -5,6 +5,7 @@ verify_ssl = true
[dev-packages]
httpie = "*"
flake8 = "*"
django-rest-swagger = "*"
[packages]
......
......@@ -50,3 +50,6 @@ A fejlesztés elkezdéséhez egy Django szerverrel fogunk dolgozni, mely az open
|------| |------| |---------| |--------|
```
### Devenv Setup
### Lease kezelés
Lease kezelés egyelőre nem lesz. A későbbiekben majd lesz valamilyen collector, ami időközönként lefut és ellenőrzi a suspended_at és a deleted_at változókat.
export OS_AUTH_URL=http://example/identity/v3
export OS_PROJECT_ID=123456789
export OS_PROJECT_NAME="example"
export OS_USER_DOMAIN_NAME="example"
export OS_USER_DOMAIN_ID="example"
export OS_PROJECT_DOMAIN_ID="example"
export OS_USERNAME="example"
export OS_PASSWORD=secret
export OS_REGION_NAME="example"
export OS_INTERFACE="example"
export OS_IDENTITY_API_VERSION=123
\ No newline at end of file
......@@ -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
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,13 +4,10 @@ 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):
......@@ -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"}]
......@@ -58,7 +55,7 @@ class InstanceDetail(APIView):
instance = self.get_object(pk)
instanceDict = InstanceSerializer(instance).data
interface = OSVirtualMachineManager(conn)
interface = OSVirtualMachineManager(settings.CONNECTION)
remoteInstance = interface.get_vm(instance.remote_id)
remoteInstanceDict = remoteInstance.__dict__
......
Subproject commit dc7e976d672c15d4f2f771d9a1fad0459d133f61
Subproject commit e01d873c78ac17fed0438936f979de3cbaca6a5e
......@@ -117,6 +117,7 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.1/howto/static-files/
STATIC_URL = "/static/"
###############################################################################
......@@ -156,3 +157,17 @@ LEASE_TYPES = [
# CORS config for development version only
CORS_ORIGIN_WHITELIST = ("http://localhost:3000",)
CONNECTION = {
"auth_url": os.getenv("OS_AUTH_URL"),
"project_id": os.getenv("OS_PROJECT_ID"),
"project_name": os.getenv("OS_PROJECT_NAME"),
"user_domain_name": os.getenv("OS_USER_DOMAIN_NAME", "Default"),
"user_domain_id": os.getenv("OS_USER_DOMAIN_ID", "default"),
"project_domain_id": os.getenv("OS_PROJECT_DOMAIN_ID", "default"),
"username": os.getenv("OS_USERNAME"),
"password": os.getenv("OS_PASSWORD"),
"region_name": os.getenv("OS_REGION_NAME"),
"interface": os.getenv("OS_INTERFACE"),
"identity_api_version": os.getenv("OS_IDENTITY_API_VERSION"),
}
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