add services in register a new device
This commit is contained in:
parent
79c2ecbd81
commit
66e162db4d
|
@ -5,12 +5,11 @@ from typing import Type
|
||||||
import boltons.urlutils
|
import boltons.urlutils
|
||||||
import click
|
import click
|
||||||
import click_spinner
|
import click_spinner
|
||||||
import ereuse_devicehub.ereuse_utils.cli
|
|
||||||
from ereuse_devicehub.ereuse_utils.session import DevicehubClient
|
|
||||||
from flask import _app_ctx_stack, g
|
from flask import _app_ctx_stack, g
|
||||||
from flask_login import LoginManager, current_user
|
from flask_login import LoginManager, current_user
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
|
|
||||||
|
import ereuse_devicehub.ereuse_utils.cli
|
||||||
from ereuse_devicehub.auth import Auth
|
from ereuse_devicehub.auth import Auth
|
||||||
from ereuse_devicehub.client import Client, UserClient
|
from ereuse_devicehub.client import Client, UserClient
|
||||||
|
|
||||||
|
@ -19,6 +18,7 @@ from ereuse_devicehub.commands.users import GetToken
|
||||||
from ereuse_devicehub.config import DevicehubConfig
|
from ereuse_devicehub.config import DevicehubConfig
|
||||||
from ereuse_devicehub.db import db
|
from ereuse_devicehub.db import db
|
||||||
from ereuse_devicehub.dummy.dummy import Dummy
|
from ereuse_devicehub.dummy.dummy import Dummy
|
||||||
|
from ereuse_devicehub.ereuse_utils.session import DevicehubClient
|
||||||
from ereuse_devicehub.resources.device.search import DeviceSearch
|
from ereuse_devicehub.resources.device.search import DeviceSearch
|
||||||
from ereuse_devicehub.resources.inventory import Inventory, InventoryDef
|
from ereuse_devicehub.resources.inventory import Inventory, InventoryDef
|
||||||
from ereuse_devicehub.resources.user.models import User
|
from ereuse_devicehub.resources.user.models import User
|
||||||
|
@ -26,6 +26,11 @@ from ereuse_devicehub.teal.db import ResourceNotFound, SchemaSQLAlchemy
|
||||||
from ereuse_devicehub.teal.teal import Teal
|
from ereuse_devicehub.teal.teal import Teal
|
||||||
from ereuse_devicehub.templating import Environment
|
from ereuse_devicehub.templating import Environment
|
||||||
|
|
||||||
|
try:
|
||||||
|
from ereuse_devicehub.modules.commands.sync_dlt import GetMembers
|
||||||
|
except Exception:
|
||||||
|
GetMembers = None
|
||||||
|
|
||||||
|
|
||||||
class Devicehub(Teal):
|
class Devicehub(Teal):
|
||||||
test_client_class = Client
|
test_client_class = Client
|
||||||
|
@ -73,6 +78,8 @@ class Devicehub(Teal):
|
||||||
self.dummy = Dummy(self)
|
self.dummy = Dummy(self)
|
||||||
# self.report = Report(self)
|
# self.report = Report(self)
|
||||||
self.get_token = GetToken(self)
|
self.get_token = GetToken(self)
|
||||||
|
if GetMembers:
|
||||||
|
self.get_members = GetMembers(self)
|
||||||
|
|
||||||
@self.cli.group(
|
@self.cli.group(
|
||||||
short_help='Inventory management.',
|
short_help='Inventory management.',
|
||||||
|
|
|
@ -973,7 +973,13 @@ class Device(Thing):
|
||||||
c.register_dlt()
|
c.register_dlt()
|
||||||
|
|
||||||
if app.config('ID_FEDERATED'):
|
if app.config('ID_FEDERATED'):
|
||||||
api.add_service(self.chid, 'devicehub', app.config('ID_FEDERATED'), '', '')
|
api.add_service(
|
||||||
|
self.chid,
|
||||||
|
'DeviceHub',
|
||||||
|
app.config('ID_FEDERATED'),
|
||||||
|
'Inventory service',
|
||||||
|
'Inv',
|
||||||
|
)
|
||||||
|
|
||||||
def unreliable(self):
|
def unreliable(self):
|
||||||
self.user_trusts = False
|
self.user_trusts = False
|
||||||
|
|
Reference in New Issue