From 40f00933ba06993dc1797bc0aafd03a0f8206570 Mon Sep 17 00:00:00 2001 From: Ulrich Date: Fri, 14 Apr 2023 14:31:24 +0200 Subject: [PATCH] frame check-config with open editor --- basic/program.py | 17 +++-------------- check_configuration.py | 31 +++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/basic/program.py b/basic/program.py index 0c71b25..7ebd3d8 100644 --- a/basic/program.py +++ b/basic/program.py @@ -9,6 +9,7 @@ #import sys, getopt import argparse import copy +import subprocess import time import yaml @@ -155,20 +156,6 @@ class Job: self.setParameter(args) self.m = basic.message.Message(self, self.programDef[CTLG_LOGLEVEL], logTime, None) - def altinit(self, program, args): - appl = tools.config_tool.getConfig(self, P.KEY_BASIC, B.SUBJECT_APPS) - if appl is not None: - self.conf[B.SUBJECT_APPS] = appl[B.SUBJECT_APPS] - if B.SUBJECT_PROJECTS in self.conf: - for k in self.conf[B.SUBJECT_PROJECTS]: - if k not in appl[B.SUBJECT_PROJECTS]: - raise Exception("Workspace has project "+k+" which is not configured") - self.conf[B.SUBJECT_PROJECTS][k] = appl[B.SUBJECT_PROJECTS][k] - else: - self.conf[B.SUBJECT_PROJECTS] = appl[B.SUBJECT_PROJECTS] - par = Parameter(self, program, args) - self.par = par - def getLogpath(self): path = tools.path_tool.compose_path(self, self.programDef[CTLG_LOGPATH], None) return path @@ -240,6 +227,8 @@ class Job: print("Logpath: "+self.m.logpath) print(footer1) print(footer2) + if "editor" in self.conf[B.SUBJECT_PATH]: + subprocess.Popen([self.conf[B.SUBJECT_PATH]["editor"], str(self.m.logpath)]) if reboot == 0: exit(rc) diff --git a/check_configuration.py b/check_configuration.py index 21c4bf0..854a0ca 100644 --- a/check_configuration.py +++ b/check_configuration.py @@ -10,6 +10,7 @@ import tools.path_const as P import tools.config_tool as config_tool import tools.file_tool as file_tool import model.component +import model.table PROGRAM_NAME = "check_configuration" @@ -18,7 +19,7 @@ def startPyJob(job): job.m.logDebug("--- start " + PROGRAM_NAME + " ------>>>>") components = job.par.component.split(",") for c in components: - print("component "+c) + job.m.logInfo("------------------------------------------\ncheck component "+c) checkComponent(job, c) job.m.setMsg("Job " + PROGRAM_NAME + " fertig") job.m.logDebug("<<<<<<<<----- " + PROGRAM_NAME + " ------") @@ -50,7 +51,33 @@ def checkComponent(job, componentName): if len(configTree["conf"][x]) != 1: job.m.setWarn("none is not the only subject in "+x) continue - + comps = model.component.select_components(job, None, None) + job.m.logInfo("Komponenten pruefen") + for c in configTree["conf"][model.component.CP_SUBJECT_COMPS]: + if c in ["none"]: + continue + if c not in comps: + job.m.setError(componentName + ": component " + c + " does not exist") + job.m.logInfo("- " + componentName + " uses component " + c) + job.m.logInfo("Steps pruefen") + for v in configTree["conf"][model.component.CP_SUBJECT_STEPS]: + if v == "none": + continue + job.m.logInfo("- "+componentName + " uses variant "+v) + job.m.logInfo("Tabellen pruefen") + tables = model.table.select_tables(job, None, None) + for t in configTree["conf"][model.component.CP_SUBJECT_TABLES]: + if t == "none": + continue + if t in tables: + job.m.logInfo("- "+componentName + " uses table " + t) + else: + job.m.setError(componentName + ": table " + t + " ist not defined.") + job.m.logInfo("Artefakte pruefen") + for a in configTree["conf"][model.component.CP_SUBJECT_ARTS]: + if t == "none": + continue + job.m.logInfo("- "+componentName + " uses artifact " + a) if __name__ == '__main__':