Browse Source

frame check-config with open editor

refactor
Ulrich 2 years ago
parent
commit
40f00933ba
  1. 17
      basic/program.py
  2. 31
      check_configuration.py

17
basic/program.py

@ -9,6 +9,7 @@
#import sys, getopt #import sys, getopt
import argparse import argparse
import copy import copy
import subprocess
import time import time
import yaml import yaml
@ -155,20 +156,6 @@ class Job:
self.setParameter(args) self.setParameter(args)
self.m = basic.message.Message(self, self.programDef[CTLG_LOGLEVEL], logTime, None) 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): def getLogpath(self):
path = tools.path_tool.compose_path(self, self.programDef[CTLG_LOGPATH], None) path = tools.path_tool.compose_path(self, self.programDef[CTLG_LOGPATH], None)
return path return path
@ -240,6 +227,8 @@ class Job:
print("Logpath: "+self.m.logpath) print("Logpath: "+self.m.logpath)
print(footer1) print(footer1)
print(footer2) 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: if reboot == 0:
exit(rc) exit(rc)

31
check_configuration.py

@ -10,6 +10,7 @@ import tools.path_const as P
import tools.config_tool as config_tool import tools.config_tool as config_tool
import tools.file_tool as file_tool import tools.file_tool as file_tool
import model.component import model.component
import model.table
PROGRAM_NAME = "check_configuration" PROGRAM_NAME = "check_configuration"
@ -18,7 +19,7 @@ def startPyJob(job):
job.m.logDebug("--- start " + PROGRAM_NAME + " ------>>>>") job.m.logDebug("--- start " + PROGRAM_NAME + " ------>>>>")
components = job.par.component.split(",") components = job.par.component.split(",")
for c in components: for c in components:
print("component "+c) job.m.logInfo("------------------------------------------\ncheck component "+c)
checkComponent(job, c) checkComponent(job, c)
job.m.setMsg("Job " + PROGRAM_NAME + " fertig") job.m.setMsg("Job " + PROGRAM_NAME + " fertig")
job.m.logDebug("<<<<<<<<----- " + PROGRAM_NAME + " ------") job.m.logDebug("<<<<<<<<----- " + PROGRAM_NAME + " ------")
@ -50,7 +51,33 @@ def checkComponent(job, componentName):
if len(configTree["conf"][x]) != 1: if len(configTree["conf"][x]) != 1:
job.m.setWarn("none is not the only subject in "+x) job.m.setWarn("none is not the only subject in "+x)
continue 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__': if __name__ == '__main__':

Loading…
Cancel
Save