Merge pull request #176 from future-architect/add_sudo_check_to_prepare

Add sudo check to prepare subcommand
This commit is contained in:
Kota Kanbe
2016-09-14 08:54:55 +09:00
committed by GitHub
2 changed files with 7 additions and 1 deletions

View File

@@ -140,6 +140,12 @@ func (p *PrepareCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{
logger.Info("Detecting OS... ")
scan.InitServers(logger)
logger.Info("Checking sudo configuration... ")
if err := scan.CheckIfSudoNoPasswd(logger); err != nil {
logger.Errorf("Failed to sudo with nopassword via SSH. Define NOPASSWD in /etc/sudoers on target servers")
return subcommands.ExitFailure
}
logger.Info("Installing...")
if errs := scan.Prepare(); 0 < len(errs) {
for _, e := range errs {

View File

@@ -369,7 +369,7 @@ func detectContainerOSesOnServer(containerHost osTypeInterface) (oses []osTypeIn
// CheckIfSudoNoPasswd checks whether vuls can sudo with nopassword via SSH
func CheckIfSudoNoPasswd(localLogger *logrus.Entry) error {
timeoutSec := 1 * 15
timeoutSec := 15
errs := parallelSSHExec(func(o osTypeInterface) error {
return o.checkIfSudoNoPasswd()
}, timeoutSec)