mirror of
https://github.com/rancher/os.git
synced 2025-08-10 02:58:15 +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:
commit
fa14b6960b
@ -15,6 +15,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func bootstrapAction(c *cli.Context) error {
|
func bootstrapAction(c *cli.Context) error {
|
||||||
|
log.InitLogger()
|
||||||
|
log.Info("Running cloud-init-save")
|
||||||
|
|
||||||
log.Debugf("bootstrapAction")
|
log.Debugf("bootstrapAction")
|
||||||
if err := UdevSettle(); err != nil {
|
if err := UdevSettle(); err != nil {
|
||||||
log.Errorf("Failed to run udev settle: %v", err)
|
log.Errorf("Failed to run udev settle: %v", err)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
exec &>> /var/log/boot/autoformat.log
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
MAGIC=${MAGIC:-"boot2docker, please format-me"}
|
MAGIC=${MAGIC:-"boot2docker, please format-me"}
|
||||||
|
15
init/init.go
15
init/init.go
@ -359,11 +359,20 @@ func RunInit() error {
|
|||||||
}
|
}
|
||||||
// And all the files in /var/log/boot/
|
// 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()
|
// 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 {
|
if files, err := ioutil.ReadDir(bootLog); err == nil {
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
filePath := filepath.Join(bootLog, file.Name())
|
filePath := filepath.Join(bootLog, file.Name())
|
||||||
filesToCopy = append(filesToCopy, filePath)
|
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 {
|
for _, name := range filesToCopy {
|
||||||
@ -373,7 +382,7 @@ func RunInit() error {
|
|||||||
log.Errorf("read cfg file (%s) %s", name, err)
|
log.Errorf("read cfg file (%s) %s", name, err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Debugf("Saved %s to memory", name)
|
log.Debugf("Swizzle: Saved %s to memory", name)
|
||||||
configFiles[name] = content
|
configFiles[name] = content
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -405,7 +414,7 @@ func RunInit() error {
|
|||||||
if err := util.WriteFileAtomic(name, content, fileMode); err != nil {
|
if err := util.WriteFileAtomic(name, content, fileMode); err != nil {
|
||||||
log.Error(err)
|
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 {
|
if err := os.MkdirAll(config.VarRancherDir, os.ModeDir|0755); err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user