diff options
| author | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2026-03-11 10:07:21 +0100 |
|---|---|---|
| committer | sarthurdev <965089+sarthurdev@users.noreply.github.com> | 2026-03-13 14:14:48 +0100 |
| commit | 90c7a2b8cdfd61dc48c910f9aa48354ba104c183 (patch) | |
| tree | a2001e9f9454b39754b7a2677b4f59782bc9190c /src/helpers | |
| parent | 44e5e9f0b26ce496b04f603bb68c82ecf01dc54a (diff) | |
| download | vyos-1x-90c7a2b8cdfd61dc48c910f9aa48354ba104c183.tar.gz vyos-1x-90c7a2b8cdfd61dc48c910f9aa48354ba104c183.zip | |
geoip: T6768: Add system name-server check
Diffstat (limited to 'src/helpers')
| -rwxr-xr-x | src/helpers/geoip-update.py | 17 |
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() |
