Fix qemu check and add debug lines when a driver is disabled

This commit is contained in:
Alex Dadgar 2015-09-22 17:36:44 -07:00
parent bbb3853dd8
commit dd2f16123f
3 changed files with 5 additions and 3 deletions

View file

@ -34,6 +34,7 @@ func NewExecDriver(ctx *DriverContext) Driver {
func (d *ExecDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error) {
// Only enable if we are root when running on non-windows systems.
if runtime.GOOS != "windows" && syscall.Geteuid() != 0 {
d.logger.Printf("[DEBUG] driver.exec: must run as root user, disabling")
return false, nil
}

View file

@ -40,6 +40,7 @@ func NewJavaDriver(ctx *DriverContext) Driver {
func (d *JavaDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error) {
// Only enable if we are root when running on non-windows systems.
if runtime.GOOS != "windows" && syscall.Geteuid() != 0 {
d.logger.Printf("[DEBUG] driver.java: must run as root user, disabling")
return false, nil
}

View file

@ -54,9 +54,9 @@ func NewQemuDriver(ctx *DriverContext) Driver {
}
func (d *QemuDriver) Fingerprint(cfg *config.Config, node *structs.Node) (bool, error) {
// Only enable if we are root. This check also disables on Windows as
// Geteuid() returns -1.
if syscall.Geteuid() != 0 {
// Only enable if we are root when running on non-windows systems.
if runtime.GOOS != "windows" && syscall.Geteuid() != 0 {
d.logger.Printf("[DEBUG] driver.qemu: must run as root user, disabling")
return false, nil
}