blackliste wird geholt und geschrieben
This commit is contained in:
Vendored
+2
-2
@@ -37,14 +37,14 @@
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
"name": "Python: TOS string to file",
|
"name": "fetch blacklist from server",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${file}",
|
"program": "${file}",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"justMyCode": true,
|
"justMyCode": true,
|
||||||
"args": [
|
"args": [
|
||||||
"--outfile=blubb.txt"
|
"--blacklist"
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,5 @@
|
|||||||
CALL cremig_setenv.bat
|
CALL cremig_setenv.bat
|
||||||
IF NOT EXIST %CREMIG%\.venv CALL %CREMIG_BIN%\install_py.bat
|
IF NOT EXIST %CREMIG%\.venv CALL %CREMIG_BIN%\install_py.bat
|
||||||
CALL %CREMIG%\.venv\Scripts\activate.bat
|
CALL %CREMIG%\.venv\Scripts\activate.bat
|
||||||
IF "%1" == "-s" (set SIVAS_ID=%2) else (set /p SIVAS_ID=Enter Sivas ID:)
|
python %CREMIG_LIB%\update_database.py --blacklist
|
||||||
python %CREMIG_LIB%\update_database.py --sivas=%SIVAS_ID%
|
|
||||||
deactivate
|
deactivate
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ set PATH=%CREMIG%\bin;%PATH%
|
|||||||
|
|
||||||
set RD_DATABASE_SOURCE=\\ssg.local\freigaben\SIVAS_CAD_EDM\Migration\07_RD_Teilenummern
|
set RD_DATABASE_SOURCE=\\ssg.local\freigaben\SIVAS_CAD_EDM\Migration\07_RD_Teilenummern
|
||||||
set RD_DATABASE_NAME=RD_Teilenummern.csv
|
set RD_DATABASE_NAME=RD_Teilenummern.csv
|
||||||
|
set BLACKLIST_DATABASE_SOURCE=\\ruledesigner\RDF_Daten\Konfigurator\CustomVaulting
|
||||||
|
set BLACKLIST_DATABASE_NAME=ERP_BOM.ini
|
||||||
set VBA_MACRO_NAME=vba_format_excel.xlsm
|
set VBA_MACRO_NAME=vba_format_excel.xlsm
|
||||||
set SIVAS_DATABASE_QUERY=Y:\jit\programme\Sivas2json.exe
|
set SIVAS_DATABASE_QUERY=Y:\jit\programme\Sivas2json.exe
|
||||||
REM set SIVAS_TEILESTAMM=\\195.243.223.3\sivas\NetEnv\Sivas4.exe
|
REM set SIVAS_TEILESTAMM=\\195.243.223.3\sivas\NetEnv\Sivas4.exe
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import argparse
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import configparser
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Dieses Programm:
|
Dieses Programm:
|
||||||
@@ -9,6 +10,31 @@ Dieses Programm:
|
|||||||
- Fragt Sivas ab und generiert dabei eine json-Datei, in der alle Teilenummern aufgelistet sind,
|
- Fragt Sivas ab und generiert dabei eine json-Datei, in der alle Teilenummern aufgelistet sind,
|
||||||
die in Verbindung mit einer angegebenen Teilenummer migriert werden müssen.
|
die in Verbindung mit einer angegebenen Teilenummer migriert werden müssen.
|
||||||
"""
|
"""
|
||||||
|
def get_blacklist(outdir):
|
||||||
|
"""read out list of sivas Ids which are not allowed from network drive
|
||||||
|
'//ruledesigner//DF_Daten//onfigurator//ustomVaulting//RP_BOM.ini'
|
||||||
|
within the section 'Settings'
|
||||||
|
in the key 'PartNumbersToDrop'
|
||||||
|
"""
|
||||||
|
blacklist_net_share = os.environ.get("BLACKLIST_DATABASE_SOURCE")
|
||||||
|
blacklist_ini_filename = os.environ.get("BLACKLIST_DATABASE_NAME")
|
||||||
|
blacklist_source_path = os.path.join(blacklist_net_share, blacklist_ini_filename)
|
||||||
|
config = configparser.RawConfigParser()
|
||||||
|
try:
|
||||||
|
config.read(blacklist_source_path)
|
||||||
|
except configparser.DuplicateOptionError:
|
||||||
|
pass
|
||||||
|
content = config.get('Settings','PartNumbersToDrop')
|
||||||
|
blacklist_str = content[0] # warum das als Liste erkannt wird wissen die Götter...
|
||||||
|
if len(blacklist_str) == 0 or len(content) == 0:
|
||||||
|
print(f"import of '{blacklist_ini_filename}' from '{blacklist_net_share}' failed")
|
||||||
|
exit
|
||||||
|
|
||||||
|
blacklist = blacklist_str.split(';')
|
||||||
|
|
||||||
|
outfile = os.path.join(outdir, 'blacklist.txt')
|
||||||
|
with open(outfile, 'w', encoding='utf-8') as fh:
|
||||||
|
fh.write('\n'.join(blacklist))
|
||||||
|
|
||||||
def get_rd_dbase(out_dir):
|
def get_rd_dbase(out_dir):
|
||||||
|
|
||||||
@@ -53,6 +79,7 @@ if __name__ == '__main__':
|
|||||||
parser = argparse.ArgumentParser(description='fetches data from sivas or ruledesigner fusion', prog='update_database')
|
parser = argparse.ArgumentParser(description='fetches data from sivas or ruledesigner fusion', prog='update_database')
|
||||||
parser.add_argument('-s', '--sivas', action='store', help='fetch data of this id from sivas fo local database folder', metavar='id')
|
parser.add_argument('-s', '--sivas', action='store', help='fetch data of this id from sivas fo local database folder', metavar='id')
|
||||||
parser.add_argument('-r', '--rd', action='store_true', help='fetch list of existing parts from network drive')
|
parser.add_argument('-r', '--rd', action='store_true', help='fetch list of existing parts from network drive')
|
||||||
|
parser.add_argument('-b', '--blacklist', action='store_true', help='fetch list of not allowed parts from network drive')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@@ -64,5 +91,8 @@ if __name__ == '__main__':
|
|||||||
elif args.sivas:
|
elif args.sivas:
|
||||||
get_sivas_dbase(args.sivas, out_dir)
|
get_sivas_dbase(args.sivas, out_dir)
|
||||||
|
|
||||||
|
elif args.blacklist:
|
||||||
|
get_blacklist(out_dir)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|||||||
Reference in New Issue
Block a user