chore(repo): 纳入云治理主站运行基线 #27

Merged
zheromiku merged 195 commits from integrate/cloud-main-baseline into main 2026-11-23 14:23:59 +08:00
2 changed files with 8 additions and 1 deletions
Showing only changes of commit d2f9060b33 - Show all commits
+4 -1
View File
@@ -60,7 +60,10 @@ def load_config(path=None):
if not isinstance(config, dict):
raise PPError("incomplete")
else:
legacy = pathlib.Path(os.environ.get("PP_LEGACY_CREDENTIALS_FILE") or "/run/source-secrets/pp_credentials.json")
legacy_path = os.environ.get("PP_LEGACY_CREDENTIALS_FILE")
if not legacy_path:
raise PPError("incomplete")
legacy = pathlib.Path(legacy_path)
try:
config = json.loads(legacy.read_text(encoding="utf-8"))
except (OSError, ValueError):
+4
View File
@@ -53,4 +53,8 @@ class PPClientTests(unittest.TestCase):
self.assertFalse(local);self.assertGreater(size,0);self.assertEqual(hashlib.sha256(pathlib.Path(path).read_bytes()).hexdigest(),digest)
self.assertEqual([x[0] for x in self.calls],['POST','GET','GET'])
finally:os.unlink(path)
def test_missing_state_never_implicitly_reuses_legacy_credentials(self):
fake=json.dumps({'username':'example','password':'synthetic-'+'fixture'})
with patch.dict(os.environ,{'PP_LEGACY_CREDENTIALS_FILE':''}),patch('pathlib.Path.exists',return_value=False),patch('pathlib.Path.read_text',return_value=fake):
with self.assertRaises(pp_client.PPError):pp_client.load_config('/example-missing/settings.json')
if __name__=='__main__':unittest.main()