WIP-CHECKPOINT[auth-refactor]: 固化工程师崩溃前部分成果 + 同树其他未提交WIP(仅源码,不含密钥/二进制)-- 待重激活工程师续作
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Upload nginx.conf to production server via JumpServer"""
|
||||
import base64
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Read and encode the nginx.conf file
|
||||
nginx_conf_path = os.path.join(os.path.dirname(__file__), 'nginx.conf')
|
||||
with open(nginx_conf_path, 'rb') as f:
|
||||
b64_data = base64.b64encode(f.read()).decode()
|
||||
|
||||
print(f"Encoded {len(b64_data)} characters")
|
||||
|
||||
# Create the remote Python script
|
||||
remote_script = 'python3 -c "'
|
||||
remote_script += f"import base64; data = '''{b64_data}'''; "
|
||||
remote_script += "with open('/opt/wecom-it-desk/nginx/nginx.conf', 'wb') as f: f.write(base64.b64decode(data)); print('OK')"
|
||||
remote_script += '"'
|
||||
|
||||
# Execute via jms_ops
|
||||
result = subprocess.run([
|
||||
'python', r'C:\Users\simon\.workbuddy\skills\jumpserver-ops\scripts\jms_ops.py',
|
||||
'exec', '-c', remote_script
|
||||
], capture_output=True, text=True, encoding='utf-8', errors='replace', cwd=r'd:\资料\03-项目开发\wecom_it_smart_desk')
|
||||
|
||||
print(result.stdout)
|
||||
print(result.stderr)
|
||||
Reference in New Issue
Block a user