refactor #2
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
7b6c02b3ab
commit
433a3b9817
21 changed files with 65 additions and 65 deletions
6
setup.py
6
setup.py
|
@ -17,10 +17,10 @@ except:
|
|||
|
||||
|
||||
setup(
|
||||
name="ucloud",
|
||||
name="uncloud",
|
||||
version=version,
|
||||
description="All ucloud server components.",
|
||||
url="https://code.ungleich.ch/ucloud/ucloud",
|
||||
description="uncloud cloud management",
|
||||
url="https://code.ungleich.ch/uncloud/uncloud",
|
||||
long_description=long_description,
|
||||
long_description_content_type="text/markdown",
|
||||
classifiers=[
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
|
||||
|
||||
class Optional:
|
||||
|
|
|
@ -3,8 +3,8 @@ import os
|
|||
|
||||
from uuid import uuid4
|
||||
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
|
||||
data = {
|
||||
"is_public": True,
|
||||
|
|
|
@ -7,8 +7,8 @@ import requests
|
|||
|
||||
from pyotp import TOTP
|
||||
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@ from flask import Flask, request
|
|||
from flask_restful import Resource, Api
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
from ucloud.common import counters
|
||||
from ucloud.common.vm import VMStatus
|
||||
from ucloud.common.request import RequestEntry, RequestType
|
||||
from ucloud.settings import settings
|
||||
from ucloud.shared import shared
|
||||
from uncloud.common import counters
|
||||
from uncloud.common.vm import VMStatus
|
||||
from uncloud.common.request import RequestEntry, RequestType
|
||||
from uncloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
|
||||
from . import schemas
|
||||
from .helper import generate_mac, mac2ipv6
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""
|
||||
This module contain classes thats validates and intercept/modify
|
||||
data coming from ucloud-cli (user)
|
||||
data coming from uncloud-cli (user)
|
||||
|
||||
It was primarily developed as an alternative to argument parser
|
||||
of Flask_Restful which is going to be deprecated. I also tried
|
||||
|
@ -19,10 +19,10 @@ import os
|
|||
|
||||
import bitmath
|
||||
|
||||
from ucloud.common.host import HostStatus
|
||||
from ucloud.common.vm import VMStatus
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from uncloud.common.host import HostStatus
|
||||
from uncloud.common.vm import VMStatus
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from . import helper, logger
|
||||
from .common_fields import Field, VmUUIDField
|
||||
from .helper import check_otp, resolve_vm_name
|
||||
|
|
|
@ -7,7 +7,7 @@ from .classes import SpecificEtcdEntryBase
|
|||
|
||||
|
||||
class HostStatus:
|
||||
"""Possible Statuses of ucloud host."""
|
||||
"""Possible Statuses of uncloud host."""
|
||||
|
||||
alive = "ALIVE"
|
||||
dead = "DEAD"
|
||||
|
|
|
@ -7,7 +7,7 @@ from abc import ABC
|
|||
from . import logger
|
||||
from os.path import join as join_path
|
||||
|
||||
from ucloud.settings import settings as config
|
||||
from uncloud.settings import settings as config
|
||||
|
||||
|
||||
class ImageStorageHandler(ABC):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
|
||||
from ucloud.settings import settings
|
||||
from ucloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
|
||||
|
||||
def update_config(section, kwargs):
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = "ucloud"
|
||||
project = "uncloud"
|
||||
copyright = "2019, ungleich"
|
||||
author = "ungleich"
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import time
|
|||
from uuid import uuid4
|
||||
|
||||
from . import logger
|
||||
from ucloud.settings import settings
|
||||
from ucloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
|
||||
|
||||
def sha512sum(file: str):
|
||||
|
|
|
@ -2,11 +2,11 @@ import argparse
|
|||
import multiprocessing as mp
|
||||
import time
|
||||
|
||||
from ucloud.common.request import RequestEntry, RequestType
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from ucloud.common.vm import VMStatus
|
||||
from ucloud.vmm import VMM
|
||||
from uncloud.common.request import RequestEntry, RequestType
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from uncloud.common.vm import VMStatus
|
||||
from uncloud.vmm import VMM
|
||||
from os.path import join as join_path
|
||||
|
||||
from . import virtualmachine, logger
|
||||
|
@ -48,7 +48,7 @@ def main(hostname):
|
|||
heartbeat_updating_process = mp.Process(target=update_heartbeat, args=(hostname,))
|
||||
heartbeat_updating_process.start()
|
||||
except Exception as e:
|
||||
raise Exception("ucloud-host heartbeat updating mechanism is not working") from e
|
||||
raise Exception("uncloud-host heartbeat updating mechanism is not working") from e
|
||||
|
||||
for events_iterator in [
|
||||
shared.etcd_client.get_prefix(settings["etcd"]["request_prefix"], value_in_json=True),
|
||||
|
|
|
@ -11,14 +11,14 @@ import ipaddress
|
|||
from string import Template
|
||||
from os.path import join as join_path
|
||||
|
||||
from ucloud.common.request import RequestEntry, RequestType
|
||||
from ucloud.common.vm import VMStatus, declare_stopped
|
||||
from ucloud.common.network import create_dev, delete_network_interface
|
||||
from ucloud.common.schemas import VMSchema, NetworkSchema
|
||||
from ucloud.host import logger
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from ucloud.vmm import VMM
|
||||
from uncloud.common.request import RequestEntry, RequestType
|
||||
from uncloud.common.vm import VMStatus, declare_stopped
|
||||
from uncloud.common.network import create_dev, delete_network_interface
|
||||
from uncloud.common.schemas import VMSchema, NetworkSchema
|
||||
from uncloud.host import logger
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from uncloud.vmm import VMM
|
||||
|
||||
from marshmallow import ValidationError
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ import os
|
|||
import subprocess as sp
|
||||
|
||||
from os.path import join as join_path
|
||||
from ucloud.settings import settings
|
||||
from ucloud.shared import shared
|
||||
from ucloud.imagescanner import logger
|
||||
from uncloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
from uncloud.imagescanner import logger
|
||||
|
||||
|
||||
def qemu_img_type(path):
|
||||
|
|
|
@ -4,8 +4,8 @@ from flask import Flask, request
|
|||
from flask_restful import Resource, Api
|
||||
from werkzeug.exceptions import HTTPException
|
||||
|
||||
from ucloud.settings import settings
|
||||
from ucloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from uncloud.shared import shared
|
||||
|
||||
app = Flask(__name__)
|
||||
api = Api(app)
|
||||
|
|
|
@ -3,11 +3,11 @@ from functools import reduce
|
|||
|
||||
import bitmath
|
||||
|
||||
from ucloud.common.host import HostStatus
|
||||
from ucloud.common.request import RequestEntry, RequestType
|
||||
from ucloud.common.vm import VMStatus
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from uncloud.common.host import HostStatus
|
||||
from uncloud.common.request import RequestEntry, RequestType
|
||||
from uncloud.common.vm import VMStatus
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
|
||||
|
||||
def accumulated_specs(vms_specs):
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
# 2. Introduce a status endpoint of the scheduler -
|
||||
# maybe expose a prometheus compatible output
|
||||
|
||||
from ucloud.common.request import RequestEntry, RequestType
|
||||
from ucloud.shared import shared
|
||||
from ucloud.settings import settings
|
||||
from uncloud.common.request import RequestEntry, RequestType
|
||||
from uncloud.shared import shared
|
||||
from uncloud.settings import settings
|
||||
from .helper import (
|
||||
dead_host_mitigation,
|
||||
dead_host_detection,
|
||||
|
|
|
@ -15,7 +15,7 @@ from main import (
|
|||
main,
|
||||
)
|
||||
|
||||
from ucloud.config import etcd_client
|
||||
from uncloud.config import etcd_client
|
||||
|
||||
|
||||
class TestFunctions(unittest.TestCase):
|
||||
|
|
|
@ -3,7 +3,7 @@ import logging
|
|||
import sys
|
||||
import os
|
||||
|
||||
from ucloud.common.etcd_wrapper import Etcd3Wrapper
|
||||
from uncloud.common.etcd_wrapper import Etcd3Wrapper
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -14,7 +14,7 @@ class CustomConfigParser(configparser.RawConfigParser):
|
|||
result = super().__getitem__(key)
|
||||
except KeyError as err:
|
||||
raise KeyError(
|
||||
"Key '{}' not found in configuration. Make sure you configure ucloud.".format(
|
||||
"Key '{}' not found in configuration. Make sure you configure uncloud.".format(
|
||||
key
|
||||
)
|
||||
) from err
|
||||
|
@ -24,9 +24,9 @@ class CustomConfigParser(configparser.RawConfigParser):
|
|||
|
||||
class Settings(object):
|
||||
def __init__(self, config_key="/uncloud/config/"):
|
||||
conf_name = "ucloud.conf"
|
||||
conf_name = "uncloud.conf"
|
||||
conf_dir = os.environ.get(
|
||||
"UCLOUD_CONF_DIR", os.path.expanduser("~/ucloud/")
|
||||
"UCLOUD_CONF_DIR", os.path.expanduser("~/uncloud/")
|
||||
)
|
||||
self.config_file = os.path.join(conf_dir, conf_name)
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Settings(object):
|
|||
self.config_parser.read_dict(config_from_etcd.value)
|
||||
else:
|
||||
raise KeyError(
|
||||
"Key '{}' not found in etcd. Please configure ucloud.".format(
|
||||
"Key '{}' not found in etcd. Please configure uncloud.".format(
|
||||
self.config_key
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
from ucloud.settings import settings
|
||||
from ucloud.common.vm import VmPool
|
||||
from ucloud.common.host import HostPool
|
||||
from ucloud.common.request import RequestPool
|
||||
from ucloud.common.storage_handlers import get_storage_handler
|
||||
from uncloud.settings import settings
|
||||
from uncloud.common.vm import VmPool
|
||||
from uncloud.common.host import HostPool
|
||||
from uncloud.common.request import RequestPool
|
||||
from uncloud.common.storage_handlers import get_storage_handler
|
||||
|
||||
|
||||
class Shared:
|
||||
|
|
|
@ -102,7 +102,7 @@ class VMM:
|
|||
def __init__(
|
||||
self,
|
||||
qemu_path="/usr/bin/qemu-system-x86_64",
|
||||
vmm_backend=os.path.expanduser("~/ucloud/vmm/"),
|
||||
vmm_backend=os.path.expanduser("~/uncloud/vmm/"),
|
||||
):
|
||||
self.qemu_path = qemu_path
|
||||
self.vmm_backend = vmm_backend
|
||||
|
|
Loading…
Reference in a new issue