X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=osm_policy_module%2Fcore%2Fdatabase.py;fp=osm_policy_module%2Fcore%2Fdatabase.py;h=6423b5e51242e69104fecbe5142f9b0f03f5b7b9;hb=be42d54170ca40d8d52e2c9fc8d888621585d6cf;hp=e596d74fb48515a550f4b4492e26dbd05f7b6141;hpb=3cab75bfb39b4f03509ccb90dc26404bceec557a;p=osm%2FPOL.git diff --git a/osm_policy_module/core/database.py b/osm_policy_module/core/database.py index e596d74..6423b5e 100644 --- a/osm_policy_module/core/database.py +++ b/osm_policy_module/core/database.py @@ -98,7 +98,7 @@ class VnfAlarm(BaseModel): nsr_id = CharField() vnf_member_index = CharField() vdu_name = CharField() - last_action = CharField(default='insufficient-data') + last_action = CharField(default="insufficient-data") id_suffix = IntegerField() ok_ack = BooleanField(default=False) alarm_ack = BooleanField(default=False) @@ -122,7 +122,7 @@ class HealingAction(BaseModel): cooldown_time = IntegerField() count_index = IntegerField() last_heal = DateTimeField(default=datetime.datetime.now) - last_status = CharField(default='insufficient-data') + last_status = CharField(default="insufficient-data") day1 = BooleanField(default=False) @@ -141,7 +141,7 @@ class DatabaseManager: class ScalingAlarmRepository: @staticmethod def list(*expressions) -> Iterable[ScalingAlarm]: - return ScalingAlarm.select().where(*expressions) + return ScalingAlarm.select().where(*expressions).__iter__() @staticmethod def get(*expressions, join_classes: List = None) -> ScalingAlarm: @@ -159,7 +159,7 @@ class ScalingAlarmRepository: class ScalingGroupRepository: @staticmethod def list(*expressions) -> Iterable[ScalingGroup]: - return ScalingGroup.select().where(*expressions) + return ScalingGroup.select().where(*expressions).__iter__() @staticmethod def get(*expressions) -> ScalingGroup: @@ -177,7 +177,7 @@ class ScalingPolicyRepository: if join_classes: for join_class in join_classes: query = query.join(join_class) - return query.where(*expressions) + return query.where(*expressions).__iter__() @staticmethod def get(*expressions, join_classes: List = None) -> ScalingPolicy: @@ -199,7 +199,7 @@ class ScalingCriteriaRepository: if join_classes: for join_class in join_classes: query = query.join(join_class) - return query.where(*expressions) + return query.where(*expressions).__iter__() @staticmethod def get(*expressions, join_classes: List = None) -> ScalingCriteria: @@ -217,7 +217,7 @@ class ScalingCriteriaRepository: class VnfAlarmRepository: @staticmethod def list(*expressions) -> Iterable[VnfAlarm]: - return VnfAlarm.select().where(*expressions) + return VnfAlarm.select().where(*expressions).__iter__() @staticmethod def get(*expressions) -> VnfAlarm: @@ -231,7 +231,7 @@ class VnfAlarmRepository: class AlarmActionRepository: @staticmethod def list(*expressions) -> Iterable[AlarmAction]: - return AlarmAction.select().where(*expressions) + return AlarmAction.select().where(*expressions).__iter__() @staticmethod def get(*expressions) -> AlarmAction: @@ -245,8 +245,12 @@ class AlarmActionRepository: class HealingActionRepository: @staticmethod def list(*expressions) -> Iterable[HealingAction]: - log.info("### Printing healing action db alarm {}".format(HealingAction.select().where(*expressions))) - return HealingAction.select().where(*expressions) + log.info( + "### Printing healing action db alarm {}".format( + HealingAction.select().where(*expressions) + ) + ) + return HealingAction.select().where(*expressions).__iter__() @staticmethod def get(*expressions) -> HealingAction: