mirror of
https://github.com/rancher/os.git
synced 2025-09-03 07:44:21 +00:00
Get RancherOS logging to throw debug logs to a remote syslog server when the kernel netconsole is configured
Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
|
||||
"github.com/SvenDowideit/cpuid"
|
||||
"github.com/docker/docker/pkg/mount"
|
||||
"github.com/rancher/os/log"
|
||||
)
|
||||
|
||||
func mountProc() error {
|
||||
@@ -94,20 +93,18 @@ func Unmount(target string) error {
|
||||
return mount.Unmount(target)
|
||||
}
|
||||
|
||||
func Blkid(label string) (deviceName, deviceType string) {
|
||||
func Blkid(label string) (deviceName, deviceType string, err error) {
|
||||
// Not all blkid's have `blkid -L label (see busybox/alpine)
|
||||
cmd := exec.Command("blkid")
|
||||
cmd.Stderr = os.Stderr
|
||||
out, err := cmd.Output()
|
||||
if err != nil {
|
||||
log.Errorf("Failed to run blkid: %s", err)
|
||||
return
|
||||
}
|
||||
r := bytes.NewReader(out)
|
||||
s := bufio.NewScanner(r)
|
||||
for s.Scan() {
|
||||
line := s.Text()
|
||||
//log.Debugf("blkid: %s", cmd, line)
|
||||
if !strings.Contains(line, `LABEL="`+label+`"`) {
|
||||
continue
|
||||
}
|
||||
@@ -117,7 +114,6 @@ func Blkid(label string) (deviceName, deviceType string) {
|
||||
s1 := strings.Split(line, `TYPE="`)
|
||||
s2 := strings.Split(s1[1], `"`)
|
||||
deviceType = s2[0]
|
||||
log.Debugf("blkid type of %s: %s", deviceName, deviceType)
|
||||
return
|
||||
}
|
||||
return
|
||||
@@ -125,10 +121,5 @@ func Blkid(label string) (deviceName, deviceType string) {
|
||||
|
||||
// GetHypervisor tries to detect if we're running in a VM, and returns a string for its type
|
||||
func GetHypervisor() string {
|
||||
if cpuid.CPU.HypervisorName == "" {
|
||||
log.Infof("ros init: No Detected Hypervisor")
|
||||
} else {
|
||||
log.Infof("ros init: Detected Hypervisor: %s", cpuid.CPU.HypervisorName)
|
||||
}
|
||||
return cpuid.CPU.HypervisorName
|
||||
}
|
||||
|
Reference in New Issue
Block a user