

def add_apt_key(filename=None, url=None, keyid=None, keyserver='subkeys.pgp.net', update=False):
    "\n    Trust packages signed with this public key.\n\n    Example::\n\n        import fabtools\n\n        # Varnish signing key from URL and verify fingerprint)\n        fabtools.deb.add_apt_key(keyid='C4DEFFEB', url='http://repo.varnish-cache.org/debian/GPG-key.txt')\n\n        # Nginx signing key from default key server (subkeys.pgp.net)\n        fabtools.deb.add_apt_key(keyid='7BD9BF62')\n\n        # From custom key server\n        fabtools.deb.add_apt_key(keyid='7BD9BF62', keyserver='keyserver.ubuntu.com')\n\n        # From a file\n        fabtools.deb.add_apt_key(keyid='7BD9BF62', filename='nginx.asc'\n    "
    if (keyid is None):
        if (filename is not None):
            run_as_root(('apt-key add %(filename)s' % locals()))
        elif (url is not None):
            run_as_root(('wget %(url)s -O - | apt-key add -' % locals()))
        else:
            raise ValueError('Either filename, url or keyid must be provided as argument')
    elif (filename is not None):
        _check_pgp_key(filename, keyid)
        run_as_root(('apt-key add %(filename)s' % locals()))
    elif (url is not None):
        tmp_key = ('/tmp/tmp.fabtools.key.%(keyid)s.key' % locals())
        run_as_root(('wget %(url)s -O %(tmp_key)s' % locals()))
        _check_pgp_key(tmp_key, keyid)
        run_as_root(('apt-key add %(tmp_key)s' % locals()))
    else:
        keyserver_opt = (('--keyserver %(keyserver)s' % locals()) if (update is not None) else '')
        run_as_root(('apt-key adv %(keyserver_opt)s --recv-keys %(keyid)s' % locals()))
    if update:
        update_index()

dataset/ETHPy150Open ronnix/fabtools/fabtools/deb.py add_apt_key/VarMisuse@190/608 `keyserver`->`update`