summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2026-03-15 08:04:55 +0000
committerGitHub <noreply@github.com>2026-03-15 08:04:55 +0000
commit433f5aea24b415682318bb491f67d35eb03eac75 (patch)
treecde4a99eabb90e065524ceed273d653031496403 /src
parent7c1117b83eb966516fb8c314443a93249becd9ee (diff)
parentbd6f445c6dcf59cc5276741b92d27ac7ca3b3ee6 (diff)
downloadvyos-1x-433f5aea24b415682318bb491f67d35eb03eac75.tar.gz
vyos-1x-433f5aea24b415682318bb491f67d35eb03eac75.zip
Merge pull request #5043 from sarthurdev/geoip_opmode
geoip: T5405: T6768: Add VRF support and `system name-server` check
Diffstat (limited to 'src')
-rwxr-xr-xsrc/helpers/geoip-update.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/helpers/geoip-update.py b/src/helpers/geoip-update.py
index 8a414267e..18ad0ecb8 100755
--- a/src/helpers/geoip-update.py
+++ b/src/helpers/geoip-update.py
@@ -13,6 +13,8 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Note: script is used both in opmode and by build hook `40-init-geoip-database.chroot`
import argparse
import sys
@@ -26,12 +28,7 @@ from vyos.geoip import db_import_dbip_ranges
from vyos.geoip import db_import_maxmind_ranges
from vyos.geoip import geoip_update
-def get_config(config=None):
- if config:
- conf = config
- else:
- conf = ConfigTreeQuery()
-
+def get_config(conf):
return (
conf.get_config_dict(['firewall', 'global-options', 'geoip'], key_mangling=('-', '_'), get_first_key=True,
no_tag_node_value_mangle=True, with_defaults=True),
@@ -51,7 +48,13 @@ if __name__ == '__main__':
db_import_dbip_ranges(delete_file=True)
sys.exit(0)
- options, firewall, policy = get_config()
+ conf = ConfigTreeQuery()
+
+ if not conf.exists(['system', 'name-server']):
+ print('There are no system name-servers configured')
+ sys.exit(1)
+
+ options, firewall, policy = get_config(conf)
if not db_is_initialised():
db_initialise()