Rename mode to permissions in fs.cue

Signed-off-by: Vasek - Tom C <tom.chauveau@epitech.eu>
This commit is contained in:
Vasek - Tom C 2021-12-22 14:17:52 +01:00
parent 8819a859a1
commit fd6d1b55fe
No known key found for this signature in database
GPG Key ID: 175D82E572427960
8 changed files with 30 additions and 31 deletions

View File

@ -24,8 +24,8 @@ func (t *mkdirTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
return nil, err
}
// Mode (int)
mode, err := v.Lookup("mode").Int64()
// Permissions (int)
permissions, err := v.Lookup("permissions").Int64()
if err != nil {
return nil, err
}
@ -58,7 +58,7 @@ func (t *mkdirTask) Run(ctx context.Context, pctx *plancontext.Context, s solver
// Add Mkdir operation on input llb state
outputState := inputState.File(
llb.Mkdir(path, fs.FileMode(mode), mkdirOpts...),
llb.Mkdir(path, fs.FileMode(permissions), mkdirOpts...),
withCustomName(v, "Mkdir %s", path),
)

View File

@ -48,7 +48,7 @@ func (t *writeFileTask) Run(ctx context.Context, pctx *plancontext.Context, s so
return nil, err
}
mode, err := v.Lookup("mode").Int64()
permissions, err := v.Lookup("permissions").Int64()
if err != nil {
return nil, err
@ -67,7 +67,7 @@ func (t *writeFileTask) Run(ctx context.Context, pctx *plancontext.Context, s so
}
outputState := inputState.File(
llb.Mkfile(path, fs.FileMode(mode), contents),
llb.Mkfile(path, fs.FileMode(permissions), contents),
withCustomName(v, "WriteFile %s", path),
)
@ -77,11 +77,11 @@ func (t *writeFileTask) Run(ctx context.Context, pctx *plancontext.Context, s so
return nil, err
}
fs := pctx.FS.New(result)
outputFS := pctx.FS.New(result)
output := compiler.NewValue()
if err := output.FillPath(cue.ParsePath("output"), fs.MarshalCUE()); err != nil {
if err := output.FillPath(cue.ParsePath("output"), outputFS.MarshalCUE()); err != nil {
return nil, err
}

View File

@ -11,8 +11,8 @@ package engine
// It can be nested (e.g : "/foo" or "/foo/bar")
path: string
// Permissions to set
mode: *0o755 | int
// Permissions of the directory
permissions: *0o755 | int
// If set, it creates parents' directory if they do not exist
parents: *true | false
@ -43,8 +43,7 @@ package engine
// Contents to write
contents: string
// Permissions of the file
// FIXME: rename to 'permissions' for consistency
mode: int
permissions: int
// Output filesystem tree
output: #FS
}

View File

@ -19,7 +19,7 @@ engine.#Plan & {
input: mkdir.output
path: "/test/foo"
contents: "bar"
mode: 700
permissions: 700
}
readChecker: engine.#ReadFile & {

View File

@ -20,7 +20,7 @@ engine.#Plan & {
input: mkdir.output
path: "/test/baz/foo"
contents: "bar"
mode: 700
permissions: 700
}
readChecker: engine.#ReadFile & {

View File

@ -19,7 +19,7 @@ engine.#Plan & {
input: mkdir.output
path: "/test/baz/foo"
contents: "bar"
mode: 700
permissions: 700
}
readChecker: engine.#ReadFile & {

View File

@ -13,7 +13,7 @@ engine.#Plan & {
input: pull.output
path: "/testing"
contents: "1,2,3"
mode: 700
permissions: 700
}
readfile: engine.#ReadFile & {
input: write.output

View File

@ -13,7 +13,7 @@ engine.#Plan & {
input: pull.output
path: "/testing"
contents: "1,2,3,4"
mode: 700
permissions: 700
}
readfile: engine.#ReadFile & {
input: write.output