Skip to content

Commit

Permalink
rename are_dns_bound to is_dns_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Aug 1, 2024
1 parent 175839a commit 2c0438a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions imageroot/actions/configure-module/10validate
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ if request["dhcp-server"]["enabled"]:
sys.exit(2)

if request["dns-server"]["enabled"]:
are_dns_bound = network.are_ports_53_bound()
is_dns_bound = network.are_ports_53_bound()
# read config.json and determine if dns is used for this instance
config = json.load(open("config.json"))
is_dns_enabled = config["dns-server"]["enabled"]
# check if dns is already bound to port 53 and stop the action
if are_dns_bound and not is_dns_enabled:
if is_dns_bound and not is_dns_enabled:
agent.set_status('validation-failed')
json.dump([{'field':'dnsEnableField', 'parameter':'dnsEnableField', 'value': request['dns-server']['enabled'], 'error':'dns_port_already_bind'}], fp=sys.stdout)
sys.exit(3)
2 changes: 1 addition & 1 deletion imageroot/actions/get-configuration/10get
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ if config["interface"] != "" and config["dhcp-server"]["start"] == "" and config
config["dhcp-server"]["end"] = str(interface["end"])

# we test if tcp/53 or udp/53 is bound to the interface
config["are_dns_bound"] = network.are_ports_53_bound()
config["is_dns_bound"] = network.are_ports_53_bound()
# check if dnsmasq is enabled in the configuration, needed to determine in the UI if the DNS server was enabled and used by dnsmasq.
# the dnsmasq service is always running, we cannot state if it is enabled/active or not.
config['is_dns_enabled'] = config["dns-server"]["enabled"]
Expand Down
4 changes: 2 additions & 2 deletions imageroot/actions/get-configuration/validate-output.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"description": "True if dnsmasq is configured",
"type": "boolean"
},
"are_dns_bound": {
"is_dns_bound": {
"description": "True if DNS servers are bound to the interface",
"type": "boolean"
}
Expand All @@ -111,6 +111,6 @@
"dhcp-server",
"dns-server",
"is_dns_enabled",
"are_dns_bound"
"is_dns_bound"
]
}
10 changes: 5 additions & 5 deletions ui/src/views/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@
{{ $t("settings.DNS_description") }}
</div>
<cv-row
v-if="are_dns_bound && !dnsEnableField && !is_dns_enabled"
v-if="is_dns_bound && !dnsEnableField && !is_dns_enabled"
>
<cv-column>
<NsInlineNotification
Expand All @@ -182,7 +182,7 @@
value="dnsEnableField"
formItem
:disabled="
are_dns_bound && !dnsEnableField && !is_dns_enabled
is_dns_bound && !dnsEnableField && !is_dns_enabled
"
ref="dnsEnableField"
>
Expand Down Expand Up @@ -220,7 +220,7 @@
:disabled="
loading.getConfiguration ||
loading.configureModule ||
(are_dns_bound && !dnsEnableField && !is_dns_enabled)
(is_dns_bound && !dnsEnableField && !is_dns_enabled)
"
>{{ $t("settings.save") }}</NsButton
>
Expand Down Expand Up @@ -269,7 +269,7 @@ export default {
dhcpStartField: "",
dhcpEndField: "",
dhcpLeaseField: 12,
are_dns_bound: false,
is_dns_bound: false,
is_dns_enabled: false,
dnsEnableField: false,
dnsPrimaryField: "",
Expand Down Expand Up @@ -427,7 +427,7 @@ export default {
this.dnsEnableField = dns_server["enabled"];
this.dnsPrimaryField = dns_server["primary-server"];
this.dnsSecondaryField = dns_server["secondary-server"];
this.are_dns_bound = config["are_dns_bound"];
this.is_dns_bound = config["is_dns_bound"];
this.is_dns_enabled = config["is_dns_enabled"];
},
validateConfigureModule() {
Expand Down

0 comments on commit 2c0438a

Please sign in to comment.