ordo/examples/interceptor.scm

34 lines
1.6 KiB
Scheme

(use-modules
(ice-9 filesystem)
(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 command)
(ordo interceptor debug))
(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 (var file-content)
#:register 'hello)
(stat-file
"stat-hello"
#:path (var hello)
#:register 'hello-stat)
(command "list-tmp-dir" (list "ls" "-l" (var tmp-dir) #:check? #t) #:register 'dir-list)
(command "list-root-dir" (list "ls" "-l" "/root" #:check? #f) #:register 'root-list)
(debug-vars)))))