linuxmuster / linuxmuster-linuxclient7

The new approach on connecting linuxclients to the Linuxmuster.net v7 Active Directory server.
3 stars 5 forks source link

Login-freezes: Set Timeout by lpadmin-command #41

Closed martin-res closed 2 years ago

martin-res commented 2 years ago

Problem: Login freezes if CUPS is not a local CUPS and user has AD-printers use timeout with e.g. 5 seconds File: printers.py

def _installPrinter(username, networkPath, name):
    logging.debug("_installPrinter Printer {0} on {1}".format(name, networkPath))
    installCommand = ["timeout", "5", "lpadmin", "-p", name, "-E", "-v", networkPath, "-m", "everywhere", "-u", f"allow:{username}"]
    logging.debug("* running '{}'".format(" ".join(installCommand)))
    p = subprocess.Popen(installCommand, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    output, error = p.communicate()
    if p.returncode  == 0:
        logging.debug("* Success _installPrinter!")
        return True
    elif p.returncode == 124:
        logging.debug("* Error Timeout lpadmin")
    else:
        logging.debug(f"* Error installing printer {name} on {networkPath}!\n")
        logging.debug(f"* stderr: {error}")
    return False
dorianim commented 2 years ago

Hi @martin-res

I am currently very busy, and cannot implement this myself. But if you submit a pull request, I'd be happy to review it :)

regards, Dorian