mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-19 07:54:45 +01:00
Merge branch 'main' into feature
This commit is contained in:
@@ -566,28 +566,23 @@ class BaseScript:
|
||||
def load_yaml(self, filename):
|
||||
"""
|
||||
Return data from a YAML file
|
||||
TODO: DEPRECATED: Remove this method in v4.4
|
||||
"""
|
||||
# TODO: DEPRECATED: Remove this method in v4.4
|
||||
self._log(
|
||||
_("load_yaml is deprecated and will be removed in v4.4"),
|
||||
level=LogLevelChoices.LOG_WARNING
|
||||
)
|
||||
try:
|
||||
from yaml import CLoader as Loader
|
||||
except ImportError:
|
||||
from yaml import Loader
|
||||
|
||||
file_path = os.path.join(settings.SCRIPTS_ROOT, filename)
|
||||
with open(file_path, 'r') as datafile:
|
||||
data = yaml.load(datafile, Loader=Loader)
|
||||
data = yaml.load(datafile, Loader=yaml.SafeLoader)
|
||||
|
||||
return data
|
||||
|
||||
def load_json(self, filename):
|
||||
"""
|
||||
Return data from a JSON file
|
||||
TODO: DEPRECATED: Remove this method in v4.4
|
||||
"""
|
||||
# TODO: DEPRECATED: Remove this method in v4.4
|
||||
self._log(
|
||||
_("load_json is deprecated and will be removed in v4.4"),
|
||||
level=LogLevelChoices.LOG_WARNING
|
||||
|
||||
Reference in New Issue
Block a user