env/instances: Guarantee that right 'authorized_keys' file is created

This commit is contained in:
Tom Wiesing 2022-09-08 17:30:28 +02:00
parent 086b359e17
commit 477152814a
No known key found for this signature in database
2 changed files with 7 additions and 9 deletions

10
env/instances.go vendored
View file

@ -245,14 +245,12 @@ func (instance Instance) Stack() stack.Installable {
"GLOBAL_AUTHORIZED_KEYS_FILE": instance.dis.Config.GlobalAuthorizedKeysFile,
},
CopyContextFiles: nil,
TouchFiles: []string{
"authorized_keys",
},
MakeDirsPerm: fs.ModeDir | fs.ModePerm,
MakeDirs: []string{"data", ".composer"},
TouchFiles: []string{
filepath.Join("data", "authorized_keys"),
},
}
}

View file

@ -23,10 +23,10 @@ type Installable struct {
CopyContextFiles []string // Files to copy from the installation context
TouchFiles []string // Files to 'touch', i.e. ensure that exist
MakeDirsPerm fs.FileMode // permission for diretories, defaults to fs.ModeDir
MakeDirs []string // directories to ensure that exist
TouchFiles []string // Files to 'touch', i.e. ensure that exist; guaranteed to be run after MakeDirs
}
// InstallationContext is a context to install data in
@ -61,7 +61,7 @@ func (is Installable) Install(io stream.IOStream, context InstallationContext) e
}
}
// make sure that certain files exist
// make sure that certain dirs exist
for _, name := range is.MakeDirs {
// find the destination!
dst := filepath.Join(is.Dir, name)