lint: tidy up code some more, pylint is enforcing
This commit is contained in:
parent
66b3ccc0f0
commit
61564e8c01
17 changed files with 72 additions and 38 deletions
|
@ -1,6 +1,7 @@
|
|||
import datetime
|
||||
import enum
|
||||
|
||||
from app.brm.brn import BRN
|
||||
from app.extensions import db
|
||||
from app.models import AbstractConfiguration, AbstractResource
|
||||
|
||||
|
@ -21,6 +22,16 @@ class Automation(AbstractConfiguration):
|
|||
|
||||
logs = db.relationship("AutomationLogs", back_populates="automation")
|
||||
|
||||
@property
|
||||
def brn(self) -> BRN:
|
||||
return BRN(
|
||||
group_id=0,
|
||||
product="core",
|
||||
provider="",
|
||||
resource_type="automation",
|
||||
resource_id=self.short_name
|
||||
)
|
||||
|
||||
def kick(self) -> None:
|
||||
self.enabled = True
|
||||
self.next_run = datetime.datetime.utcnow()
|
||||
|
@ -32,3 +43,13 @@ class AutomationLogs(AbstractResource):
|
|||
logs = db.Column(db.Text)
|
||||
|
||||
automation = db.relationship("Automation", back_populates="logs")
|
||||
|
||||
@property
|
||||
def brn(self) -> BRN:
|
||||
return BRN(
|
||||
group_id=0,
|
||||
product="core",
|
||||
provider="",
|
||||
resource_type="automationlog",
|
||||
resource_id=self.id
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue