guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 4/9] services: syslog: Use syslog-configuration.


From: David Craven
Subject: [PATCH 4/9] services: syslog: Use syslog-configuration.
Date: Thu, 1 Sep 2016 17:57:06 +0200

* gnu/services/base.scm (<syslog-configuration>): New variable.
(syslog-service-type): Use <syslog-configuration>.
(syslog-service): Use <syslog-configuration>.
---
 gnu/services/base.scm | 28 ++++++++++++++++++++--------
 gnu/tests/base.scm    |  9 ++++++---
 2 files changed, 26 insertions(+), 11 deletions(-)

diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index f3f6408..76e974c 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -73,15 +73,15 @@
 
             %nscd-default-caches
             %nscd-default-configuration
-
             nscd-configuration
             nscd-configuration?
-
             nscd-cache
             nscd-cache?
-
             nscd-service-type
             nscd-service
+
+            syslog-configuration
+            syslog-configuration?
             syslog-service
             syslog-service-type
             %default-syslog.conf
@@ -108,6 +108,7 @@
             rngd-configuration?
             rngd-service-type
             rngd-service
+
             pam-limits-service-type
             pam-limits-service
 
@@ -885,17 +886,27 @@ given @var{config}---an @code{<nscd-configuration>} 
object.  @xref{Name
 Service Switch}, for an example."
   (service nscd-service-type config))
 
+
+(define-record-type* <syslog-configuration>
+  syslog-configuration  make-syslog-configuration
+  syslog-configuration?
+  (syslogd              syslog-configuration-syslogd
+                        (default #~(string-append #$inetutils 
"/libexec/syslogd")))
+  (config-file          syslog-configuration-config-file
+                        (default %default-syslog.conf)))
+
 (define syslog-service-type
   (shepherd-service-type
    'syslog
-   (lambda (config-file)
+   (lambda (config)
      (shepherd-service
       (documentation "Run the syslog daemon (syslogd).")
       (provision '(syslogd))
       (requirement '(user-processes))
       (start #~(make-forkexec-constructor
-                (list (string-append #$inetutils "/libexec/syslogd")
-                      "--no-detach" "--rcfile" #$config-file)))
+                (list #$(syslog-configuration-syslogd config)
+                      "--no-detach"
+                      "--rcfile" #$(syslog-configuration-config-file config))))
       (stop #~(make-kill-destructor))))))
 
 ;; Snippet adapted from the GNU inetutils manual.
@@ -921,14 +932,15 @@ Service Switch}, for an example."
      mail.*                                  /var/log/maillog
 "))
 
-(define* (syslog-service #:key (config-file %default-syslog.conf))
+(define* (syslog-service #:optional (config (syslog-configuration)))
   "Return a service that runs @command{syslogd}.  If configuration file
 name @var{config-file} is not specified, use some reasonable default
 settings.
 
 @xref{syslogd invocation,,, inetutils, GNU Inetutils}, for more
 information on the configuration file syntax."
-  (service syslog-service-type config-file))
+  (service syslog-service-type config))
+
 
 (define pam-limits-service-type
   (let ((security-limits
diff --git a/gnu/tests/base.scm b/gnu/tests/base.scm
index 41f50c0..5c2af5b 100644
--- a/gnu/tests/base.scm
+++ b/gnu/tests/base.scm
@@ -384,9 +384,12 @@ functionality tests.")
                                               (log-file "/dev/console")))
                        (syslog-service-type config
                                             =>
-                                            (plain-file
-                                             "syslog.conf"
-                                             "*.* /dev/console\n")))))))
+                                            (syslog-configuration
+                                             (inherit config)
+                                             (config-file
+                                              (plain-file
+                                               "syslog.conf"
+                                               "*.* /dev/console\n")))))))))
 
 (define (run-nss-mdns-test)
   ;; Test resolution of '.local' names via libc.  Start the marionette service
-- 
2.9.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]