* [PATCH] zone: response with an error if a zone is already up or down
@ 2017-07-25 13:13 Jonatan Schlag
2017-07-25 22:32 ` Michael Tremer
0 siblings, 1 reply; 2+ messages in thread
From: Jonatan Schlag @ 2017-07-25 13:13 UTC (permalink / raw)
To: network
[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]
Fixes: #11368
Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
---
src/functions/functions.zone | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/src/functions/functions.zone b/src/functions/functions.zone
index 91ce629..eccca3a 100644
--- a/src/functions/functions.zone
+++ b/src/functions/functions.zone
@@ -369,6 +369,12 @@ zone_up() {
return ${EXIT_ERROR}
fi
+ # Check if the zone is already up
+ if zone_is_active ${zone}; then
+ log ERROR "Zone ${zone} is already up"
+ return ${EXIT_ERROR}
+ fi
+
# Check if a zone has got the remove tag.
if zone_has_destroy_tag ${zone}; then
error "Cannot bring up any zone which is to be removed."
@@ -405,6 +411,13 @@ zone_down() {
return ${EXIT_ERROR}
fi
+ # Check if the zone is already down
+ if ! zone_is_active ${zone}; then
+ log ERROR "Zone ${zone} is already down"
+ return ${EXIT_ERROR}
+ fi
+
+
local hook="$(zone_get_hook "${zone}")"
if [ -z "${hook}" ]; then
error "Config file did not provide any hook."
--
2.6.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] zone: response with an error if a zone is already up or down
2017-07-25 13:13 [PATCH] zone: response with an error if a zone is already up or down Jonatan Schlag
@ 2017-07-25 22:32 ` Michael Tremer
0 siblings, 0 replies; 2+ messages in thread
From: Michael Tremer @ 2017-07-25 22:32 UTC (permalink / raw)
To: network
[-- Attachment #1: Type: text/plain, Size: 1582 bytes --]
Hi,
this patch looks logically fine, but I sometimes use the "up" function to reload
a zone which is no longer possible.
And secondly, I am not sure if "zone_is_active" will return true when systemd
has started the script. In that case, the "up" action would be called and assume
that everything is up already and therefore never bring up the zone.
-Michael
On Tue, 2017-07-25 at 15:13 +0200, Jonatan Schlag wrote:
> Fixes: #11368
>
> Signed-off-by: Jonatan Schlag <jonatan.schlag(a)ipfire.org>
> ---
> src/functions/functions.zone | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/src/functions/functions.zone b/src/functions/functions.zone
> index 91ce629..eccca3a 100644
> --- a/src/functions/functions.zone
> +++ b/src/functions/functions.zone
> @@ -369,6 +369,12 @@ zone_up() {
> return ${EXIT_ERROR}
> fi
>
> + # Check if the zone is already up
> + if zone_is_active ${zone}; then
> + log ERROR "Zone ${zone} is already up"
> + return ${EXIT_ERROR}
> + fi
> +
> # Check if a zone has got the remove tag.
> if zone_has_destroy_tag ${zone}; then
> error "Cannot bring up any zone which is to be removed."
> @@ -405,6 +411,13 @@ zone_down() {
> return ${EXIT_ERROR}
> fi
>
> + # Check if the zone is already down
> + if ! zone_is_active ${zone}; then
> + log ERROR "Zone ${zone} is already down"
> + return ${EXIT_ERROR}
> + fi
> +
> +
> local hook="$(zone_get_hook "${zone}")"
> if [ -z "${hook}" ]; then
> error "Config file did not provide any hook."
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-25 22:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-25 13:13 [PATCH] zone: response with an error if a zone is already up or down Jonatan Schlag
2017-07-25 22:32 ` Michael Tremer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox