26
26
27
27
28
28
29
- def _create_user (cluster_id , grafana_url ,grafana_secret ,user_secret ,update_secret ):
29
+ def _create_update_user (cluster_id , grafana_url ,grafana_secret ,user_secret ,update_secret ):
30
30
if not grafana_url .startswith ("https://" ):
31
31
if grafana_url .startswith ("http://" ):
32
32
grafana_url = grafana_url .replace ("http://" , "https://" , 1 )
@@ -176,7 +176,8 @@ def create_cluster(blk_size, page_size_in_blocks, cli_pass,
176
176
c .distr_bs = distr_bs
177
177
c .distr_chunk_bs = distr_chunk_bs
178
178
c .ha_type = ha_type
179
-
179
+ c .grafana_endpoint = grafana_endpoint
180
+
180
181
alerts_template_folder = os .path .join (TOP_DIR , "simplyblock_core/scripts/alerting/" )
181
182
alert_resources_file = "alert_resources.yaml"
182
183
@@ -293,7 +294,7 @@ def deploy_spdk(node_docker, spdk_cpu_mask, spdk_mem):
293
294
294
295
295
296
def add_cluster (blk_size , page_size_in_blocks , cap_warn , cap_crit , prov_cap_warn , prov_cap_crit ,
296
- distr_ndcs , distr_npcs , distr_bs , distr_chunk_bs , ha_type , grafana_url ):
297
+ distr_ndcs , distr_npcs , distr_bs , distr_chunk_bs , ha_type ):
297
298
db_controller = DBController ()
298
299
clusters = db_controller .get_clusters ()
299
300
if not clusters :
@@ -311,8 +312,9 @@ def add_cluster(blk_size, page_size_in_blocks, cap_warn, cap_crit, prov_cap_warn
311
312
cluster .cli_pass = default_cluster .cli_pass
312
313
cluster .secret = utils .generate_string (20 )
313
314
cluster .db_connection = default_cluster .db_connection
315
+ cluster .grafana_endpoint = default_cluster .grafana_endpoint
314
316
315
- _create_user (cluster .uuid ,grafana_url ,default_cluster .secret ,cluster .secret ,False )
317
+ _create_update_user (cluster .uuid ,cluster . grafana_endpoint ,default_cluster .secret ,cluster .secret ,False )
316
318
317
319
318
320
if distr_ndcs == 0 and distr_npcs == 0 :
@@ -608,7 +610,7 @@ def get_secret(cluster_id):
608
610
return cluster .secret
609
611
610
612
611
- def set_secret (cluster_id , secret , grafana_url ):
613
+ def set_secret (cluster_id , secret ):
612
614
613
615
db_controller = DBController ()
614
616
clusters = db_controller .get_clusters ()
@@ -622,7 +624,8 @@ def set_secret(cluster_id, secret,grafana_url):
622
624
secret = secret .strip ()
623
625
if len (secret ) < 20 :
624
626
return "Secret must be at least 20 char"
625
- _create_user (cluster_id ,grafana_url ,clusters [0 ].secret ,secret ,True )
627
+
628
+ _create_update_user (cluster_id ,clusters [0 ].grafana_endpoint ,clusters [0 ].secret ,secret ,True )
626
629
627
630
cluster .secret = secret
628
631
cluster .write_to_db (db_controller .kv_store )
0 commit comments