Simplify handling of localhost in inventory
This commit is contained in:
parent
93c5cad460
commit
69f50fbadb
1 changed files with 2 additions and 3 deletions
|
@ -51,7 +51,8 @@ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
(eval-string (call-with-input-file filename get-string-all)
|
(eval-string (call-with-input-file filename get-string-all)
|
||||||
#:file filename)
|
#:file filename)
|
||||||
(when (null? *inventory*)
|
(when (null? *inventory*)
|
||||||
(log-msg 'NOTICE "Inventory is empty, only localhost will be available")))
|
(log-msg 'NOTICE "Inventory is empty, only localhost will be available")
|
||||||
|
(defhost "localhost" #:connection (local-connection))))
|
||||||
|
|
||||||
(define (tagged-every? wanted-tags)
|
(define (tagged-every? wanted-tags)
|
||||||
(lambda (h)
|
(lambda (h)
|
||||||
|
@ -67,8 +68,6 @@ this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
(define-method (resolve-hosts expr)
|
(define-method (resolve-hosts expr)
|
||||||
(match expr
|
(match expr
|
||||||
("localhost" (list (or (find (named? "localhost") *inventory*)
|
|
||||||
(make <host> #:name "localhost" #:connection (local-connection)))))
|
|
||||||
((? string? hostname) (filter (named? hostname) *inventory*))
|
((? string? hostname) (filter (named? hostname) *inventory*))
|
||||||
('all *inventory*)
|
('all *inventory*)
|
||||||
(('tagged tag) (filter (tagged-every? (list tag)) *inventory*))
|
(('tagged tag) (filter (tagged-every? (list tag)) *inventory*))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue