gnu: services: Fix fail2ban configuration serialization.

This fixes a regression from 543d971ed2 whereby
match-lambda due to configuration field reordering.

* gnu/services/security.scm:
[serialize-fail2ban-ignore-cache-configuration]: Switch to match-record.
[serialize-fail2ban-jail-filter-configuration]: Switch to match-record.
[serialize-fail2ban-jail-action-configuration]: Switch to match-record.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
This commit is contained in:
muradm 2023-01-10 17:47:56 +03:00 committed by Maxim Cournoyer
parent d0942bfd2d
commit dc403ec7f1
No known key found for this signature in database
GPG Key ID: 1260E46482E63562

View File

@ -42,11 +42,11 @@
(max-count integer "Cache size.") (max-count integer "Cache size.")
(max-time integer "Cache time.")) (max-time integer "Cache time."))
(define serialize-fail2ban-ignore-cache-configuration (define (serialize-fail2ban-ignore-cache-configuration config)
(match-lambda (match-record config <fail2ban-ignore-cache-configuration>
(($ <fail2ban-ignore-cache-configuration> _ key max-count max-time) (key max-count max-time)
(format #f "key=\"~a\", max-count=~d, max-time=~d" (format #f "key=\"~a\", max-count=~d, max-time=~d"
key max-count max-time)))) key max-count max-time)))
(define-maybe/no-serialization string) (define-maybe/no-serialization string)
@ -54,10 +54,10 @@
(name string "Filter to use.") (name string "Filter to use.")
(mode maybe-string "Mode for filter.")) (mode maybe-string "Mode for filter."))
(define serialize-fail2ban-jail-filter-configuration (define (serialize-fail2ban-jail-filter-configuration config)
(match-lambda (match-record config <fail2ban-jail-filter-configuration>
(($ <fail2ban-jail-filter-configuration> _ name mode) (name mode)
(format #f "~a~@[[mode=~a]~]" name (maybe-value mode))))) (format #f "~a~@[[mode=~a]~]" name (maybe-value mode))))
(define (argument? a) (define (argument? a)
(and (pair? a) (and (pair? a)
@ -86,9 +86,9 @@
(format #f "~a=~a" (car e) (any-value (cdr e)))))) (format #f "~a=~a" (car e) (any-value (cdr e))))))
(format #f "~a" (string-join (map key-value args) ",")))) (format #f "~a" (string-join (map key-value args) ","))))
(define serialize-fail2ban-jail-action-configuration (define (serialize-fail2ban-jail-action-configuration config)
(match-lambda (match-record config <fail2ban-jail-action-configuration>
(($ <fail2ban-jail-action-configuration> _ name arguments) (name arguments)
(format (format
#f "~a~a" #f "~a~a"
name name
@ -96,7 +96,7 @@
(format (format
#f "[~a]" #f "[~a]"
(serialize-fail2ban-jail-action-configuration-arguments (serialize-fail2ban-jail-action-configuration-arguments
arguments))))))) arguments))))))
(define fail2ban-backend->string (define fail2ban-backend->string
(match-lambda (match-lambda