forked from uncloud/uncloud
find ucloud -name \*.py -exec sed -i "s/ucloud/uncloud/g" {} \;
This commit is contained in:
parent
70c8da544e
commit
7b6c02b3ab
68 changed files with 0 additions and 0 deletions
34
uncloud/shared/__init__.py
Normal file
34
uncloud/shared/__init__.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
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
|
||||
|
||||
|
||||
class Shared:
|
||||
@property
|
||||
def etcd_client(self):
|
||||
return settings.get_etcd_client()
|
||||
|
||||
@property
|
||||
def host_pool(self):
|
||||
return HostPool(
|
||||
self.etcd_client, settings["etcd"]["host_prefix"]
|
||||
)
|
||||
|
||||
@property
|
||||
def vm_pool(self):
|
||||
return VmPool(self.etcd_client, settings["etcd"]["vm_prefix"])
|
||||
|
||||
@property
|
||||
def request_pool(self):
|
||||
return RequestPool(
|
||||
self.etcd_client, settings["etcd"]["request_prefix"]
|
||||
)
|
||||
|
||||
@property
|
||||
def storage_handler(self):
|
||||
return get_storage_handler()
|
||||
|
||||
|
||||
shared = Shared()
|
||||
Loading…
Add table
Add a link
Reference in a new issue