aboutsummaryrefslogtreecommitdiff
path: root/src/data.lisp
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2022-03-03 15:19:39 -0700
committerSean Whitton <spwhitton@spwhitton.name>2022-03-22 11:14:11 -0700
commit20a017681dce547f0246651e8152aaf84c0c0f27 (patch)
tree6a41348b26446fc84cf17ea8fe78c7489c968450 /src/data.lisp
parent293e1b299445e73f9149b6e6950dcefdd3c9c299 (diff)
downloadconsfigurator-20a017681dce547f0246651e8152aaf84c0c0f27.tar.gz
rework prerequisite data naming conventions & add some validation
We now give an exhaustive specification of which IDEN1 are valid, rather than simply reserving some patterns. Also introduce terminology of "prerequisite data identifiers". Drop the idea that IDEN1 might be nil. Additionally reserve IDEN1 beginning with three hyphens. State that third party extensions shouldn't use _CONTEXT. Disallow forms not listed. Thanks to David Bremner for discussion. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src/data.lisp')
-rw-r--r--src/data.lisp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/data.lisp b/src/data.lisp
index 307d0c1..ac5c6e9 100644
--- a/src/data.lisp
+++ b/src/data.lisp
@@ -1,6 +1,6 @@
;;; Consfigurator -- Lisp declarative configuration management system
-;;; Copyright (C) 2021 Sean Whitton <spwhitton@spwhitton.name>
+;;; Copyright (C) 2021-2022 Sean Whitton <spwhitton@spwhitton.name>
;;; This file is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
@@ -173,6 +173,9 @@ This function is called by property :APPLY and :UNAPPLY subroutines."
(missing-iden1 condition) (missing-iden2 condition)))))
(defun %get-data (iden1 iden2)
+ (alet (first-char iden1)
+ (unless (or (char= #\_ it) (char= #\- it) (valid-hostname-p iden1))
+ (simple-program-error "Invalid IDEN1: ~S" iden1)))
(let* ((idenpair (cons iden1 iden2))
(from-source (query-data-sources iden1 iden2))
(from-source-version (and from-source (car from-source)))