Add sudo check to prepare subcommand

This commit is contained in:
Kota Kanbe
2016-09-14 08:52:54 +09:00
parent 00c0354a8e
commit 8a8ac5fd22
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 {