Initial project source
这个提交包含在:
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only DM inspection using private JSON credentials and the pinned JDBC jar."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
import stat
|
||||
import subprocess
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--config", required=True, type=Path)
|
||||
parser.add_argument("--write-probe", action="store_true", help="create and remove a probe table only in AIXUN_DATAGOV_DM_TEST")
|
||||
parser.add_argument("--index-probe", action="store_true")
|
||||
args = parser.parse_args()
|
||||
path = args.config.resolve()
|
||||
if not path.is_relative_to(ROOT / "runtime/dev-private") or not path.is_file():
|
||||
parser.error("configuration must be a private file under runtime/dev-private")
|
||||
if stat.S_IMODE(path.stat().st_mode) & 0o077:
|
||||
parser.error("private configuration permissions must be 0600 or stricter")
|
||||
values = json.loads(path.read_text())
|
||||
environment = os.environ.copy()
|
||||
for key in ("host", "port", "username", "password"):
|
||||
if key not in values or not str(values[key]):
|
||||
parser.error("missing private connection field: " + key)
|
||||
environment["DATAGOV_DM_" + key.upper()] = str(values[key])
|
||||
driver = ROOT / "script/datagov/m2/seatunnel/local/artifacts/DmJdbcDriver18-8.1.3.62.jar"
|
||||
return subprocess.run([
|
||||
"java", "--class-path", str(driver),
|
||||
str(ROOT / "script/database/DamengProbe.java"), *(["--index-probe"] if args.index_probe else ["--write-probe"] if args.write_probe else [])
|
||||
], env=environment, timeout=90).returncode
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
在新工单中引用
屏蔽一个用户