From f5ca06034de2419af05cbe7a5e738ce0353f7c52 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Thu, 3 Jun 2021 12:54:38 -0700 Subject: add GET-SHORT-HOSTNAME Signed-off-by: Sean Whitton --- src/package.lisp | 1 + src/property.lisp | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/package.lisp b/src/package.lisp index 07c87f7..077a5ff 100644 --- a/src/package.lisp +++ b/src/package.lisp @@ -154,6 +154,7 @@ #:push-hostattrs #:pushnew-hostattrs #:get-hostname + #:get-short-hostname #:require-data #:failed-change #:assert-euid-root diff --git a/src/property.lisp b/src/property.lisp index 52c040d..8b38db9 100644 --- a/src/property.lisp +++ b/src/property.lisp @@ -525,6 +525,13 @@ being applied. Called by property subroutines." (get-hostattrs-car :hostname host)) +(defun get-short-hostname (&optional (host *host*)) + "Get the short hostname of HOST, defaulting to the host to which properties +are being applied. + +Called by property subroutines." + (car (split-string (get-hostattrs-car :hostname host) :separator "."))) + ;;;; :APPLY subroutines -- cgit v1.2.3