aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2021-07-03 13:14:44 -0700
committerSean Whitton <spwhitton@spwhitton.name>2021-07-10 19:39:58 -0700
commite852a6f716fa947f95725cdd28e2123d055fd18b (patch)
treef142094ce946a8cbc8f31252dbfadda11d885da4
parent9533d3dde13d3ca06301514398551b90d291586e (diff)
downloadconsfigurator-e852a6f716fa947f95725cdd28e2123d055fd18b.tar.gz
HOSTNAME::DOMAIN: fix handling hostnames without any '.'
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
-rw-r--r--src/package.lisp2
-rw-r--r--src/property/hostname.lisp4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/package.lisp b/src/package.lisp
index 6665a48..bb63089 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -622,7 +622,7 @@
#:u-boot-installed-rockchip))
(defpackage :consfigurator.property.hostname
- (:use #:cl #:consfigurator)
+ (:use #:cl #:alexandria #:consfigurator)
(:local-nicknames (#:cmd #:consfigurator.property.cmd)
(#:container #:consfigurator.property.container)
(#:file #:consfigurator.property.file))
diff --git a/src/property/hostname.lisp b/src/property/hostname.lisp
index 0ff8828..da1610e 100644
--- a/src/property/hostname.lisp
+++ b/src/property/hostname.lisp
@@ -19,7 +19,9 @@
(named-readtables:in-readtable :consfigurator)
(defun domain (hostname)
- (subseq hostname (min (length hostname) (1+ (position #\. hostname)))))
+ (if-let ((pos (position #\. hostname)))
+ (subseq hostname (min (length hostname) (1+ pos)))
+ ""))
(defprop is :posix (hostname)
"Specify that the hostname of this host is HOSTNAME.