mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-11-28 23:24:49 +08:00
A convenience method.
This commit is contained in:
@@ -38,6 +38,8 @@ from sqlalchemy.orm import (
|
||||
)
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
|
||||
import modulemd as _modulemd
|
||||
|
||||
import rida.messaging
|
||||
|
||||
import logging
|
||||
@@ -137,6 +139,14 @@ class ModuleBuild(Base):
|
||||
|
||||
module = relationship('Module', backref='module_builds', lazy=False)
|
||||
|
||||
def mmd(self):
|
||||
mmd = _modulemd.ModuleMetadata()
|
||||
try:
|
||||
mmd.loads(self.modulemd)
|
||||
except:
|
||||
raise ValueError("Invalid modulemd")
|
||||
return mmd
|
||||
|
||||
@validates('state')
|
||||
def validate_state(self, key, field):
|
||||
if field in BUILD_STATES.values():
|
||||
|
||||
Reference in New Issue
Block a user