ignore_plugin, cleanup + docs

This commit is contained in:
Jokob-sk
2023-09-10 08:41:46 +10:00
parent b7417a07ad
commit 148f3198ce
13 changed files with 158 additions and 210 deletions

View File

@@ -15,26 +15,8 @@ def save_scanned_devices (db):
sql = db.sql #TO-DO
cycle = 1 # always 1, only one cycle supported
# mylog('debug', ['[ARP Scan] Detected devices:', len(p_arpscan_devices)])
# handled by the ARPSCAN plugin
# ------------------------ TO CONVERT INTO PLUGIN
# # Insert Pi-hole devices
# startTime = timeNowTZ()
# sql.execute ("""INSERT INTO CurrentScan (cur_ScanCycle, cur_MAC,
# cur_IP, cur_Vendor, cur_ScanMethod)
# SELECT ?, PH_MAC, PH_IP, PH_Vendor, 'Pi-hole'
# FROM PiHole_Network
# WHERE PH_LastQuery >= ?
# AND NOT EXISTS (SELECT 'X' FROM CurrentScan
# WHERE cur_MAC = PH_MAC
# AND cur_ScanCycle = ? )""",
# (cycle,
# (int(startTime.strftime('%s')) - 60 * p_cycle_interval),
# cycle) )
# ------------------------ TO CONVERT INTO PLUGIN
# handled by the Pi-hole plugin
# Check Internet connectivity
internet_IP = get_internet_IP( conf.DIG_GET_IP_ARG )
@@ -213,7 +195,7 @@ def create_new_devices (db):
# mylog('debug',f'[New Devices] 4 Create devices SQL: {sqlQuery}')
sql.execute (sqlQuery, (startTime, startTime) )
# sql.execute (sqlQuery, (startTime, startTime) )
# # DHCP Leases - Insert events for new devices
# mylog('debug','[New Devices] 5 DHCP Leases Events')
@@ -247,7 +229,7 @@ def create_new_devices (db):
# mylog('debug',f'[New Devices] 6 Create devices SQL: {sqlQuery}')
sql.execute (sqlQuery, (startTime, startTime) )
# sql.execute (sqlQuery, (startTime, startTime) )
mylog('debug','[New Devices] New Devices end')
db.commitDB()

View File

@@ -229,12 +229,12 @@ def importConfigs (db):
conf.mySchedules.append(schedule_class(pref, newSchedule, newSchedule.next(), False))
# Collect settings related language strings
# Creates an entry with key ARPSCAN_CMD_name
# Creates an entry with key, for example ARPSCAN_CMD_name
collect_lang_strings(db, set, pref + "_" + set["function"])
# Collect column related language strings
for clmn in plugin.get('database_column_definitions', []):
# Creates an entry with key ARPSCAN_Object_PrimaryID_name
# Creates an entry with key, for example ARPSCAN_Object_PrimaryID_name
collect_lang_strings(db, clmn, pref + "_" + clmn.get("column", ""))

View File

@@ -146,13 +146,16 @@ def get_plugins_configs():
# Loop through each directory (plugin folder) in dirs
for d in dirs:
# Check if the directory name does not start with "__" and does not end with "__ignore"
if not d.startswith("__") and not d.endswith("__ignore"):
# Construct the path to the config.json file within the plugin folder
config_path = os.path.join(pluginsPath, d, "config.json")
# Load the contents of the config.json file as a JSON object and append it to pluginsList
pluginsList.append(json.loads(get_file_content(config_path)))
# Check if the directory name does not start with "__" to skip python cache
if not d.startswith("__"):
# Check if the 'ignore_plugin' file exists in the plugin folder
ignore_plugin_path = os.path.join(pluginsPath, d, "ignore_plugin")
if not os.path.isfile(ignore_plugin_path):
# Construct the path to the config.json file within the plugin folder
config_path = os.path.join(pluginsPath, d, "config.json")
# Load the contents of the config.json file as a JSON object and append it to pluginsList
pluginsList.append(json.loads(get_file_content(config_path)))
return pluginsList # Return the list of plugin configurations