add reload button remove comments
This commit is contained in:
1 parent
b642f2af7d
commit
999e8720ee
1 file changed
+1
-11
+1
-11
@@ -5,24 +5,18 @@ from flask import Flask, request, jsonify, abort
|
|||||||
import threading
|
import threading
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
### adding reload route
|
|
||||||
# Global cache and lock
|
# Global cache and lock
|
||||||
data = None
|
data = None
|
||||||
_data_lock = threading.Lock()
|
_data_lock = threading.Lock()
|
||||||
|
|
||||||
def load_yaml():
|
def load_yaml():
|
||||||
"""Load the YAML file and return its contents."""
|
"""Load the YAML file and return its contents."""
|
||||||
with open('{{ gpo_yaml_path }}', 'r', encoding='utf-8') as f:
|
with open('{{ gpo_yaml_path }}', 'r', encoding='utf-8') as f:
|
||||||
return yaml.safe_load(f)
|
return yaml.safe_load(f)
|
||||||
|
|
||||||
# Load GPO data
|
# Load GPO data
|
||||||
with _data_lock:
|
with _data_lock:
|
||||||
data = load_yaml()
|
data = load_yaml()
|
||||||
|
|
||||||
# O.G. method
|
|
||||||
#with open('{{ gpo_yaml_path }}', 'r') as file:
|
|
||||||
# data = yaml.safe_load(file)
|
|
||||||
|
|
||||||
def strip_dn(dn: str, base_suffix: str = ",OU=Manufacturing,OU=Tesla Systems,DC=teslamotors,DC=com") -> str:
|
def strip_dn(dn: str, base_suffix: str = ",OU=Manufacturing,OU=Tesla Systems,DC=teslamotors,DC=com") -> str:
|
||||||
suffix = base_suffix.strip()
|
suffix = base_suffix.strip()
|
||||||
dn_clean = dn.strip()
|
dn_clean = dn.strip()
|
||||||
@@ -160,10 +154,6 @@ def reload_index():
|
|||||||
'gpo_links': data[0]['gpo_links']
|
'gpo_links': data[0]['gpo_links']
|
||||||
})
|
})
|
||||||
|
|
||||||
# with open('{{ gpo_yaml_path }}', 'r') as file:
|
|
||||||
# data = yaml.safe_load(file)
|
|
||||||
# return jsonify({'status': 'reloaded', 'data': data})
|
|
||||||
|
|
||||||
# test route
|
# test route
|
||||||
@app.route('/test', methods=['GET'])
|
@app.route('/test', methods=['GET'])
|
||||||
def test():
|
def test():
|
||||||
|
|||||||
Reference in new issue
Block a user