Update modules to work with interceptors

This commit is contained in:
Ray Miller 2025-01-25 15:46:12 +00:00
parent 0f6744ad30
commit d79dbadded
Signed by: ray
GPG key ID: 043F786C4CD681B8
14 changed files with 115 additions and 173 deletions

View file

@ -1,33 +1,31 @@
(use-modules
(ice-9 filesystem)
(srfi srfi-2)
(srfi srfi-71)
(logging logger)
(ordo connection)
(ordo playbook)
(ordo play)
(ordo interceptor)
(ordo interceptor install-file)
(ordo interceptor create-tmp-dir)
(ordo interceptor stat-file)
(ordo interceptor user-info)
(ordo interceptor debug)
(ordo logger))
(ordo interceptor debug))
(define chain
(list (connection-interceptor (local-connection))
(create-tmp-dir #:register 'tmp-dir)
(user-info)
(debug-vars 'user-info)
(install-file
"install-hello"
#:path (let-vars (tmp-dir) (file-name-join* tmp-dir "hello.txt"))
#:content "Hello, world!\n"
#:register 'hello)
(stat-file
"stat-hello"
#:path (let-vars (hello) hello)
#:register 'hello-stat)
(debug-vars 'hello 'hello-stat)))
(setup-logging #:level 'INFO)
(execute (init-context) chain)
(shutdown-logging)
(playbook
#:name "Test some basic filesystem operations"
#:vars '((file-content . "This is shadowed by the play variable."))
#:plays (list (play
#:name "Basic filesystem operations"
#:host "localhost"
#:vars '((file-content . "Hello, world!\n"))
#:interceptors (list (create-tmp-dir #:register 'tmp-dir)
(user-info)
(debug-vars 'user-info)
(install-file
"install-hello"
#:path (let-vars (tmp-dir) (file-name-join* tmp-dir "hello.txt"))
#:content (let-vars (file-content) file-content)
#:register 'hello)
(stat-file
"stat-hello"
#:path (let-vars (hello) hello)
#:register 'hello-stat)
(debug-vars)))))