unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: muradm <mail@muradm.net>
To: 57575@debbugs.gnu.org
Cc: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Subject: [bug#57575] [PATCH] gnu: fail2ban-service-type: Improve extra-content fields.
Date: Sun,  4 Sep 2022 14:24:42 +0300	[thread overview]
Message-ID: <20220904112442.31501-1-mail@muradm.net> (raw)

* gnu/services/security.scm:
(fail2ban-jail-configuration)[extra-content]: Change to text-config.
(fail2ban-configuration)[extra-content]: Change to text-config.
* gnu/doc/guix.texi: Update type of extra-content fields.
---
 doc/guix.texi             |  4 ++--
 gnu/services/security.scm | 15 ++++-----------
 2 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 80ca017599..b0a309efc2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -36619,7 +36619,7 @@ extensions.
 @item @code{extra-jails} (default: @code{()}) (type: list-of-fail2ban-jail-configurations)
 Instances of @code{<fail2ban-jail-configuration>} explicitly provided.
 
-@item @code{extra-content} (type: maybe-string)
+@item @code{extra-content} (default: @code{()}) (type: text-config)
 Extra raw content to add to the end of the @file{jail.local} file.
 
 @end table
@@ -36747,7 +36747,7 @@ The file names of the log files to be monitored.
 @item @code{action} (default: @code{()}) (type: list-of-fail2ban-jail-actions)
 A list of @code{<fail2ban-jail-action-configuration>}.
 
-@item @code{extra-content} (type: maybe-string)
+@item @code{extra-content} (default: @code{()}) (type: text-config)
 Extra content for the jail configuration.
 
 @end table
diff --git a/gnu/services/security.scm b/gnu/services/security.scm
index fd5bf19730..e6b59442ca 100644
--- a/gnu/services/security.scm
+++ b/gnu/services/security.scm
@@ -179,11 +179,6 @@ (define (fail2ban-jail-configuration-serialize-list-of-fail2ban-jail-actions fie
 (define (fail2ban-jail-configuration-serialize-symbol field-name value)
   (fail2ban-jail-configuration-serialize-string field-name (symbol->string value)))
 
-(define (fail2ban-jail-configuration-serialize-extra-content field-name value)
-  (if (maybe-value-set? value)
-      (string-append "\n" value "\n")
-      ""))
-
 (define-maybe integer (prefix fail2ban-jail-configuration-))
 (define-maybe string (prefix fail2ban-jail-configuration-))
 (define-maybe boolean (prefix fail2ban-jail-configuration-))
@@ -281,9 +276,9 @@ (define-configuration fail2ban-jail-configuration
    (list-of-fail2ban-jail-actions '())
    "A list of @code{<fail2ban-jail-action-configuration>}.")
   (extra-content
-   maybe-string
+   (text-config '())
    "Extra content for the jail configuration."
-   fail2ban-jail-configuration-serialize-extra-content)
+   serialize-text-config)
   (prefix fail2ban-jail-configuration-))
 
 (define list-of-fail2ban-jail-configurations?
@@ -312,7 +307,7 @@ (define-configuration/no-serialization fail2ban-configuration
    (list-of-fail2ban-jail-configurations '())
    "Instances of @code{<fail2ban-jail-configuration>} explicitly provided.")
   (extra-content
-   maybe-string
+   (text-config '())
    "Extra raw content to add to the end of the @file{jail.local} file."))
 
 (define (serialize-fail2ban-configuration config)
@@ -322,9 +317,7 @@ (define (serialize-fail2ban-configuration config)
     (interpose
      (append (map serialize-fail2ban-jail-configuration
                   (append jails extra-jails))
-             (list (if (maybe-value-set? extra-content)
-                       extra-content
-                       ""))))))
+             (list (serialize-text-config 'extra-content extra-content))))))
 
 (define (config->fail2ban-etc-directory config)
   (let* ((fail2ban (fail2ban-configuration-fail2ban config))
-- 
2.37.2





             reply	other threads:[~2022-09-04 11:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04 11:24 muradm [this message]
2022-09-14 15:32 ` bug#57575: [PATCH] gnu: fail2ban-service-type: Improve extra-content fields Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220904112442.31501-1-mail@muradm.net \
    --to=mail@muradm.net \
    --cc=57575@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).