[pykickstart][PATCH] Add --remove-service option for the firewall command (#957809)

Brian C. Lane bcl at redhat.com
Fri Oct 4 20:43:19 UTC 2013


On Fri, Oct 04, 2013 at 06:07:04PM +0200, Martin Kolman wrote:
> The --remove-service option makes it possible to remove services
> that were enabled on the firewall.
> 
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
>  pykickstart/commands/firewall.py | 42 ++++++++++++++++++++++++++++++++++++++++
>  pykickstart/handlers/control.py  |  2 +-
>  tests/commands/firewall.py       | 10 ++++++++++
>  3 files changed, 53 insertions(+), 1 deletion(-)
> 
> diff --git a/pykickstart/commands/firewall.py b/pykickstart/commands/firewall.py
> index 664bea6..1384d63 100644
> --- a/pykickstart/commands/firewall.py
> +++ b/pykickstart/commands/firewall.py
> @@ -191,3 +191,45 @@ class F14_Firewall(F10_Firewall):
>          op = F10_Firewall._getParser(self)
>          op.remove_option("--telnet")
>          return op
> +
> +class F20_Firewall(F14_Firewall):
> +    removedKeywords = F14_Firewall.removedKeywords
> +    removedAttrs = F14_Firewall.removedAttrs
> +


You also need an updated __init__ that sets the empty value for
self.remove_services (see the F10_Firewall class).

> +        # remove service
> +        if "--remove-service" in self.optionList:
> +            self.assert_parse("firewall --remove-service=mdns")  # remove only
> +            # service & remove service at once
> +            self.assert_parse("firewall --service=ssh --remove-service=mdns")
> +            # with alternative service notation
> +            self.assert_parse("firewall --ssh --smtp --ftp --remove-service=mdns")
> +            # multiple remove & remove ssh
> +            self.assert_parse("firewall --service=mdns --remove-service=dhcpv6-client --remove-service=ssh")
> +

These are missing the result string, which is just the original with \n
on the end.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 482 bytes
Desc: not available
URL: <https://lists.fedorahosted.org/pipermail/anaconda-patches/attachments/20131004/3a88c6d5/attachment.sig>


More information about the anaconda-patches mailing list