def _addSudoIfNeeded(self, cmds): sudo, sudopwd = config.getSudo() if sudo: Logger.log("Should use sudo") if sudopwd: cmds = 'echo %s | sudo -S %s' % (sudopwd, cmds) else: # If there is no need for password, cmd Line must be used cmdList = ['sudo'] cmdList.extend( cmds ) cmds = cmdList return cmds
def _addSudoIfNeeded(self, cmds): sudo, sudopwd = config.getSudo() if sudo: Logger.log("Should use sudo") if sudopwd: cmds = 'echo %s | sudo -S %s' % (sudopwd, cmds) else: # If there is no need for password, cmd Line must be used cmdList = ['sudo'] cmdList.extend(cmds) cmds = cmdList return cmds
def _shouldUseCmdList(self): sudo, sudopwd = config.getSudo() return not sudopwd