1
0
mirror of https://github.com/rancher/os.git synced 2025-07-31 06:32:09 +00:00

Merge pull request #2086 from SvenDowideit/add-autoformat-logging

Log autoformat script output to /var/log/boot/autoformat.log
This commit is contained in:
Sven Dowideit 2017-09-12 15:04:41 +10:00 committed by GitHub
commit fa14b6960b
3 changed files with 16 additions and 3 deletions

View File

@ -15,6 +15,9 @@ import (
)
func bootstrapAction(c *cli.Context) error {
log.InitLogger()
log.Info("Running cloud-init-save")
log.Debugf("bootstrapAction")
if err := UdevSettle(); err != nil {
log.Errorf("Failed to run udev settle: %v", err)

View File

@ -1,4 +1,5 @@
#!/bin/bash
exec &>> /var/log/boot/autoformat.log
set -ex
MAGIC=${MAGIC:-"boot2docker, please format-me"}

View File

@ -359,11 +359,20 @@ func RunInit() error {
}
// And all the files in /var/log/boot/
// TODO: I wonder if we can put this code into the log module, and have things write to the buffer until we FsReady()
bootLog := "/var/log/boot/"
bootLog := "/var/log/"
if files, err := ioutil.ReadDir(bootLog); err == nil {
for _, file := range files {
filePath := filepath.Join(bootLog, file.Name())
filesToCopy = append(filesToCopy, filePath)
log.Debugf("Swizzle: Found %s to save", filePath)
}
}
bootLog = "/var/log/boot/"
if files, err := ioutil.ReadDir(bootLog); err == nil {
for _, file := range files {
filePath := filepath.Join(bootLog, file.Name())
filesToCopy = append(filesToCopy, filePath)
log.Debugf("Swizzle: Found %s to save", filePath)
}
}
for _, name := range filesToCopy {
@ -373,7 +382,7 @@ func RunInit() error {
log.Errorf("read cfg file (%s) %s", name, err)
continue
}
log.Debugf("Saved %s to memory", name)
log.Debugf("Swizzle: Saved %s to memory", name)
configFiles[name] = content
}
}
@ -405,7 +414,7 @@ func RunInit() error {
if err := util.WriteFileAtomic(name, content, fileMode); err != nil {
log.Error(err)
}
log.Infof("Wrote log to %s", name)
log.Infof("Swizzle: Wrote file to %s", name)
}
if err := os.MkdirAll(config.VarRancherDir, os.ModeDir|0755); err != nil {
log.Error(err)