mirror of
https://github.com/mtan93/cachet-url-monitor.git
synced 2026-03-08 05:31:58 +00:00
Changing the actions to enum list so it's more flexible.
This commit is contained in:
@@ -7,10 +7,11 @@ import re
|
||||
import time
|
||||
|
||||
import requests
|
||||
import status as st
|
||||
from yaml import dump
|
||||
from yaml import load
|
||||
|
||||
import status as st
|
||||
|
||||
# This is the mandatory fields that must be in the configuration file in this
|
||||
# same exact structure.
|
||||
configuration_mandatory_fields = {
|
||||
@@ -100,6 +101,15 @@ class Configuration(object):
|
||||
"""
|
||||
return 'update_status' in self.data['cachet'] and self.data['cachet']['update_status']
|
||||
|
||||
def get_action(self):
|
||||
"""Retrieves the action list from the configuration. If it's empty, returns an empty list.
|
||||
:return: The list of actions, which can be an empty list.
|
||||
"""
|
||||
if self.data['cachet'].get('action') is None:
|
||||
return []
|
||||
else:
|
||||
return self.data['cachet']['action']
|
||||
|
||||
def validate(self):
|
||||
"""Validates the configuration by verifying the mandatory fields are
|
||||
present and in the correct format. If the validation fails, a
|
||||
|
||||
Reference in New Issue
Block a user