|
@@ -24,6 +24,13 @@ class Cognos7Config:
|
|
|
prot_dir: str
|
|
|
|
|
|
|
|
|
+@dataclass
|
|
|
+class Cognos11Credentials:
|
|
|
+ namespace: str
|
|
|
+ username: str
|
|
|
+ password: str
|
|
|
+
|
|
|
+
|
|
|
@dataclass
|
|
|
class Cognos11Config:
|
|
|
logs_dir: str
|
|
@@ -34,6 +41,7 @@ class Cognos11Config:
|
|
|
folders_file: str
|
|
|
reports_file: str
|
|
|
jobs_file: str
|
|
|
+ credetials: Cognos11Credentials
|
|
|
|
|
|
|
|
|
def joinpath(path, *other):
|
|
@@ -41,95 +49,104 @@ def joinpath(path, *other):
|
|
|
|
|
|
|
|
|
class Config:
|
|
|
- kunde = 'Test'
|
|
|
- version = 'C11'
|
|
|
+ kunde = "Test"
|
|
|
+ version = "C11"
|
|
|
versand_separat = False
|
|
|
cognos7: Cognos7Config
|
|
|
cognos11: Cognos11Config
|
|
|
_cfg = {}
|
|
|
|
|
|
- def __init__(self, ini='GAPS.ini'):
|
|
|
+ def __init__(self, ini="GAPS.ini"):
|
|
|
self._cfg = {}
|
|
|
|
|
|
self.tools_dir = Path(os.curdir).absolute()
|
|
|
self.tasks_dir = str(self.tools_dir.parent).lower()
|
|
|
- if self.tools_dir.parent.name.lower() != 'tasks':
|
|
|
+ if self.tools_dir.parent.name.lower() != "tasks":
|
|
|
# development
|
|
|
- self.tools_dir = self.tools_dir.joinpath('gctools')
|
|
|
- self.portal_dir = 'c:\\globalcube'
|
|
|
+ self.tools_dir = self.tools_dir.joinpath("gctools")
|
|
|
+ self.portal_dir = "c:\\globalcube"
|
|
|
if not Path(self.portal_dir).exists():
|
|
|
- self.portal_dir = joinpath(self.tools_dir, 'Portal')
|
|
|
+ self.portal_dir = joinpath(self.tools_dir, "Portal")
|
|
|
else:
|
|
|
base_dir = self.tools_dir.parent.parent
|
|
|
- if base_dir.name.lower() != 'globalcube':
|
|
|
- self.version = 'C7'
|
|
|
+ if base_dir.name.lower() != "globalcube":
|
|
|
+ self.version = "C7"
|
|
|
self.portal_dir = str(base_dir)
|
|
|
|
|
|
- self.system_dir = joinpath(self.portal_dir, 'System')
|
|
|
- self.tasks_dir = joinpath(self.portal_dir, 'Tasks')
|
|
|
- self.xml_dir = joinpath(self.tasks_dir, 'config')
|
|
|
- self.log_dir = joinpath(self.tasks_dir, 'logs')
|
|
|
+ self.system_dir = joinpath(self.portal_dir, "System")
|
|
|
+ self.tasks_dir = joinpath(self.portal_dir, "Tasks")
|
|
|
+ self.xml_dir = joinpath(self.tasks_dir, "config")
|
|
|
+ self.log_dir = joinpath(self.tasks_dir, "logs")
|
|
|
|
|
|
- if ':' not in ini:
|
|
|
+ if ":" not in ini:
|
|
|
ini = joinpath(self.tasks_dir, ini)
|
|
|
- with open(ini, 'r') as stream:
|
|
|
+ with open(ini, "r") as stream:
|
|
|
for line in stream.readlines():
|
|
|
- if '=' in line:
|
|
|
- key, value = line.split('=')
|
|
|
- self._cfg[key] = value.replace('"', '').replace('\n', '')
|
|
|
- self.kunde = self._cfg.get('KUNDE', 'Test')
|
|
|
- self.kunde_safe = self.kunde.replace(' ', '-').lower()
|
|
|
-
|
|
|
- self.system = self._cfg.get('SYSTEM', '')
|
|
|
- if self.system != '':
|
|
|
+ if "=" in line:
|
|
|
+ key, value = line.split("=")
|
|
|
+ self._cfg[key] = value.replace('"', "").replace("\n", "")
|
|
|
+ self.kunde = self._cfg.get("KUNDE", "Test")
|
|
|
+ self.kunde_safe = self.kunde.replace(" ", "-").lower()
|
|
|
+
|
|
|
+ self.system = self._cfg.get("SYSTEM", "")
|
|
|
+ if self.system != "":
|
|
|
self.system_dir = joinpath(self.system_dir, self.system)
|
|
|
self.mail_config()
|
|
|
self.cognos7_config()
|
|
|
self.cognos11_config()
|
|
|
|
|
|
def mail_config(self):
|
|
|
- self.smtp = MailConfig(**{
|
|
|
- 'server': 'mail.global-cube.com',
|
|
|
- 'port': '465',
|
|
|
- 'secure': 'ssl',
|
|
|
- 'username': 'versand',
|
|
|
- 'password': 'y6!avXX3tQvr',
|
|
|
- 'email': 'versand+neuer-kunde@global-cube.com'
|
|
|
- })
|
|
|
- if self._cfg.get('SMTP_HOST', '') != '':
|
|
|
- secure = {'': '', 'N': '', 'J': 'ssl', 'SSL': 'ssl', 'TLS': 'tls'}
|
|
|
+ self.smtp = MailConfig(
|
|
|
+ **{
|
|
|
+ "server": "mail.global-cube.com",
|
|
|
+ "port": "465",
|
|
|
+ "secure": "ssl",
|
|
|
+ "username": "versand",
|
|
|
+ "password": "y6!avXX3tQvr",
|
|
|
+ "email": "versand+neuer-kunde@global-cube.com",
|
|
|
+ }
|
|
|
+ )
|
|
|
+ if self._cfg.get("SMTP_HOST", "") != "":
|
|
|
+ secure = {"": "", "N": "", "J": "ssl", "SSL": "ssl", "TLS": "tls"}
|
|
|
|
|
|
self.smtp = MailConfig(
|
|
|
- server=self._cfg.get('SMTP_HOST'),
|
|
|
- port=self._cfg.get('SMTP_PORT'),
|
|
|
- secure=secure[self._cfg.get('SMTP_SSL', '')],
|
|
|
- username=self._cfg.get('SMTP_USER'),
|
|
|
- password=self._cfg.get('SMTP_PW'),
|
|
|
- email=self._cfg.get('SMTP_FROM'),
|
|
|
+ server=self._cfg.get("SMTP_HOST"),
|
|
|
+ port=self._cfg.get("SMTP_PORT"),
|
|
|
+ secure=secure[self._cfg.get("SMTP_SSL", "")],
|
|
|
+ username=self._cfg.get("SMTP_USER"),
|
|
|
+ password=self._cfg.get("SMTP_PW"),
|
|
|
+ email=self._cfg.get("SMTP_FROM"),
|
|
|
)
|
|
|
- self.versand_separat = self._cfg.get('VERSAND_SEPARAT') == 'J'
|
|
|
+ self.versand_separat = self._cfg.get("VERSAND_SEPARAT") == "J"
|
|
|
|
|
|
def cognos7_config(self):
|
|
|
self.cognos7 = Cognos7Config(
|
|
|
- program_dir=self._cfg.get('COGNOS', 'c:\\program files (x86)\\cognos\\cer5\\bin'),
|
|
|
- iqd_dir=joinpath(self.system_dir, 'IQD'),
|
|
|
- models_dir=joinpath(self.system_dir, 'Models'),
|
|
|
- cube_dir=joinpath(self.system_dir, 'Cube_out'),
|
|
|
- report_dir=joinpath(self.system_dir, 'Report'),
|
|
|
- publish_dir=joinpath(self.portal_dir, 'Publish', 'daten'),
|
|
|
- prot_dir=joinpath(self.system_dir, 'Prot')
|
|
|
+ program_dir=self._cfg.get(
|
|
|
+ "COGNOS", "c:\\program files (x86)\\cognos\\cer5\\bin"
|
|
|
+ ),
|
|
|
+ iqd_dir=joinpath(self.system_dir, "IQD"),
|
|
|
+ models_dir=joinpath(self.system_dir, "Models"),
|
|
|
+ cube_dir=joinpath(self.system_dir, "Cube_out"),
|
|
|
+ report_dir=joinpath(self.system_dir, "Report"),
|
|
|
+ publish_dir=joinpath(self.portal_dir, "Publish", "daten"),
|
|
|
+ prot_dir=joinpath(self.system_dir, "Prot"),
|
|
|
)
|
|
|
if not Path(self.cognos7.publish_dir).exists():
|
|
|
- self.cognos7.publish_dir = joinpath(self.portal_dir, 'daten'),
|
|
|
+ self.cognos7.publish_dir = (joinpath(self.portal_dir, "daten"),)
|
|
|
|
|
|
def cognos11_config(self):
|
|
|
self.cognos11 = Cognos11Config(
|
|
|
- logs_dir=joinpath(self.log_dir, 'c11'),
|
|
|
- reportoutput_dir=joinpath(self.portal_dir, 'ReportOutput'),
|
|
|
- specs_dir=joinpath(self.system_dir, 'Report'),
|
|
|
- webservice='http://localhost:9300/bi/',
|
|
|
- config_dir=joinpath(self.xml_dir, 'c11'),
|
|
|
- folders_file=joinpath(self.xml_dir, 'c11', 'folders.json'),
|
|
|
- reports_file=joinpath(self.xml_dir, 'c11', 'reports.json'),
|
|
|
- jobs_file=joinpath(self.xml_dir, 'c11', 'jobs.json')
|
|
|
+ logs_dir=joinpath(self.log_dir, "c11"),
|
|
|
+ reportoutput_dir=joinpath(self.portal_dir, "ReportOutput"),
|
|
|
+ specs_dir=joinpath(self.system_dir, "Report"),
|
|
|
+ webservice="http://localhost:9300/bi/",
|
|
|
+ config_dir=joinpath(self.xml_dir, "c11"),
|
|
|
+ folders_file=joinpath(self.xml_dir, "c11", "folders.json"),
|
|
|
+ reports_file=joinpath(self.xml_dir, "c11", "reports.json"),
|
|
|
+ jobs_file=joinpath(self.xml_dir, "c11", "jobs.json"),
|
|
|
+ credetials=Cognos11Credentials(
|
|
|
+ namespace=self._cfg.get("C11_NS", "CognosEx"),
|
|
|
+ username=self._cfg.get("C11_U", "Global1"),
|
|
|
+ password=self._cfg.get("C11_P", "Cognos#11"),
|
|
|
+ ),
|
|
|
)
|