mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* WIP * Add bulk sync view for config contexts * Introduce 'sync' permission for synced data models * Docs & cleanup * Remove unused method * Add a REST API endpoint to synchronize config context data
This commit is contained in:
committed by
jeremystretch
parent
664132281e
commit
678a7d17df
@@ -1,5 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
import yaml
|
||||
from fnmatch import fnmatchcase
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@@ -283,6 +284,13 @@ class DataFile(ChangeLoggingMixin, models.Model):
|
||||
except UnicodeDecodeError:
|
||||
return None
|
||||
|
||||
def get_data(self):
|
||||
"""
|
||||
Attempt to read the file data as JSON/YAML and return a native Python object.
|
||||
"""
|
||||
# TODO: Something more robust
|
||||
return yaml.safe_load(self.data_as_string)
|
||||
|
||||
def refresh_from_disk(self, source_root):
|
||||
"""
|
||||
Update instance attributes from the file on disk. Returns True if any attribute
|
||||
|
Reference in New Issue
Block a user