Skip to content

Commit 0841218

Browse files
committed
1.0.2
1 parent 109cbe5 commit 0841218

4 files changed

Lines changed: 33 additions & 8 deletions

File tree

flask-consul/manager.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/usr/bin/env python3
22
from flask import Flask
3-
from units import consul_kv
4-
import uuid
3+
from units import consul_kv,consul_manager
4+
import uuid,sys
55
from units.config_log import *
66

7+
if consul_manager.get_consul_ver() == False:
8+
sys.exit("请求consul异常, 程序退出.")
79

8-
9-
skey_path = 'ConsulManager/assets/secret/skey'
10-
if consul_kv.get_kv_dict(skey_path) == {}:
10+
skey_path = 'ConsulManager/assets/secret/'
11+
if consul_kv.get_kv_dict(skey_path + 'skey') == {}:
1112
from datetime import datetime
1213
now = datetime.strftime(datetime.now(), '%Y-%m-%d_%H-%M-%S')
1314
skeyuid = ''.join(str(uuid.uuid4()).split('-'))
14-
consul_kv.put_kv(skey_path,{'sk':skeyuid})
15-
consul_kv.put_kv(skey_path + now,{'sk':skeyuid})
15+
consul_kv.put_kv(skey_path + 'skey',{'sk':skeyuid})
16+
consul_kv.put_kv(f'{skey_path}bak-skey{now}',{'sk':skeyuid})
17+
logger.warning(f"【初始化SKey完成】")
1618

1719
from views import login, blackbox, consul, jobs, nodes, selfnode, selfrds, selfredis, avd, exp, jms, edit_cloud, ldap, rds, redis
1820
from views.prom import cloud_metrics

flask-consul/units/consul_manager.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@
44

55
headers = {'X-Consul-Token': consul_token}
66

7+
def get_consul_ver():
8+
url = f'{consul_url}/operator/autopilot/state'
9+
response = requests.get(url, headers=headers, timeout=2)
10+
response.encoding='utf-8'
11+
if response.status_code == 200:
12+
logger.info(f'【consul】请求成功, 认证成功: {consul_url} ')
13+
return True
14+
elif response.status_code == 403:
15+
logger.error(f'【consul】连接正常: {consul_url}【认证失败】请检查consul token!')
16+
return False
17+
else:
18+
logger.error(f'【consul】连接失败 {response.status_code}: {consul_url}, 请检查consul状态以及网络是否正常!')
19+
return False
20+
721
def get_hosts():
822
url = f'{consul_url}/agent/host'
923
response = requests.get(url, headers=headers)

vue-consul/src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Object.keys(filters).forEach(key => {
4646
})
4747

4848
Vue.config.productionTip = false
49-
Vue.prototype.VER = 'v1.0.1'
49+
Vue.prototype.VER = 'v1.0.2'
5050

5151
new Vue({
5252
el: '#app',

vue-consul/src/views/dashboard/index.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@
77
<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS" target="_blank" class="dashboard-text">🚀StarsL.cn</el-link>
88
</el-badge>
99
<el-timeline>
10+
<el-timeline-item timestamp="2023/10/10" placement="top">
11+
<el-card>
12+
<h4>v1.0.2</h4>
13+
<p>修复K8S部署consul无法持久化KV信息的bug<el-link :underline="false" type="primary" href="https://github.com/starsliao/TenSunS/tree/main/install/k8s" target="_blank">【查看明细】</el-link></p>
14+
<p>修复同步阿里云Redis实例报错"失败:'EndTime'"的bug</p>
15+
<p>修复采集RDS会采集到非MySql数据库的bug</p>
16+
<p>优化启动后端检查consul状态和初始化skey的逻辑</p>
17+
</el-card>
18+
</el-timeline-item>
1019
<el-timeline-item timestamp="2023/08/01" placement="top">
1120
<el-card>
1221
<h4>v1.0.1</h4>

0 commit comments

Comments
 (0)