New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] 每次更新jms版本,都会遗留上一个版本的终端 #7296
Comments
每次都下载最新的 installer 应该会解决这个问题 |
看了pod 是1天前的,我这边再留意一下 |
刚好遇到,自己写了个脚本处理 # Python 示例
# pip install requests drf-httpsig
import requests
import datetime
import json
from httpsig.requests_auth import HTTPSignatureAuth
def get_auth(KeyID, SecretID):
signature_headers = ['(request-target)', 'accept', 'date']
auth = HTTPSignatureAuth(key_id=KeyID, secret=SecretID,
algorithm='hmac-sha256', headers=signature_headers)
return auth
def get_terminal(jms_url, auth):
url = jms_url + '/api/v1/terminal/terminals/'
gmt_form = '%a, %d %b %Y %H:%M:%S GMT'
headers = {
'Accept': 'application/json',
'X-JMS-ORG': '00000000-0000-0000-0000-000000000002',
'Date': datetime.datetime.utcnow().strftime(gmt_form)
}
response = requests.get(url, auth=auth, headers=headers)
data = json.loads(response.text)
for d in data:
if d.get("status") == "offline":
id = d.get("id")
print(d.get("name"), d.get("status_display"))
del_terminal(jms_url, id, auth)
def del_terminal(jms_url, id, auth):
url = jms_url + '/api/v1/terminal/terminals/' + id +'/'
gmt_form = '%a, %d %b %Y %H:%M:%S GMT'
headers = {
'Accept': 'application/json',
'X-JMS-ORG': '00000000-0000-0000-0000-000000000002',
'Date': datetime.datetime.utcnow().strftime(gmt_form)
}
response = requests.delete(url, auth=auth, headers=headers)
print(response.text)
if __name__ == '__main__':
jms_url = 'https://demo.jumpserver.org'
KeyID = '937f9f6f-xxxx'
SecretID = '880b43fd-xxxx'
auth = get_auth(KeyID, SecretID)
get_terminal(jms_url, auth) |
您超过 30 天未反馈信息,我们将关闭该 issue,如有需求您可以重新打开或者提交新的 issue。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug 描述
每次更新jms版本,都会遗留上一个版本的终端,然后每个小时检测的时候就会发出报警,说有一大堆离线,不停地提示。
但提示的这些,是旧的终端,已经被删掉的了。
希望能批量清空遗留的离线终端,或更新后自动复用上次的终端。
Bug 重现步骤(有截图更好)
The text was updated successfully, but these errors were encountered: