Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Knot projects
Knot DNS
Commits
2c97f3b4
Commit
2c97f3b4
authored
Jan 15, 2019
by
Libor Peltan
Committed by
Daniel Salzman
Jan 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sql import: fallbacks if zone (not) exists
parent
9b216afe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
scripts/dns_sql2zf.py
scripts/dns_sql2zf.py
+17
-6
No files found.
scripts/dns_sql2zf.py
View file @
2c97f3b4
...
...
@@ -123,6 +123,11 @@ def zone_template(zone):
# this function is intended to be patched by user's bussiness logic
return
None
# param type:
# -1 ... remove this zone
# 0 ... mark this zone as modified (fallback to 2 if not exists)
# 1 ... add zone (fallback to 0 if exists already)
# 2 ... add zone no fallback (ignore if exists already)
def
knotc_send
(
type
,
zone
):
global
slave_mode
global
conf_txn_open
...
...
@@ -134,18 +139,24 @@ def knotc_send(type, zone):
knotc_zone_reload
.
append
(
zone
)
except
:
knotc_send
(
1
,
zone
)
knotc_send
(
2
,
zone
)
else
:
try
:
if
not
conf_txn_open
:
knotc_single
(
"conf-begin"
)
conf_txn_open
=
True
if
type
>
0
:
knotc_single
(
"conf-set"
,
"zone[%s]"
%
zone
)
knotc_single
(
"conf-set"
,
"zone[%s].file"
%
zone
,
zone_storage
(
zone
))
template
=
zone_template
(
remove_dot
(
zone
))
if
template
is
not
None
:
knotc_single
(
"conf-set"
,
"zone[%s].template"
%
zone
,
template
)
try
:
knotc_single
(
"conf-set"
,
"zone[%s]"
%
zone
)
knotc_single
(
"conf-set"
,
"zone[%s].file"
%
zone
,
zone_storage
(
zone
))
template
=
zone_template
(
remove_dot
(
zone
))
if
template
is
not
None
:
knotc_single
(
"conf-set"
,
"zone[%s].template"
%
zone
,
template
)
except
:
if
type
>
1
:
pass
else
:
knotc_send
(
0
,
zone
)
else
:
knotc_single
(
"conf-unset"
,
"zone[%s]"
%
zone
)
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment