[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#815202: packages: machines and sponsors information is outdated



Le 05/04/2016 07:06, Paul Wise a écrit :
> On Tue, Apr 5, 2016 at 9:05 AM, Stéphane Blondon wrote:
> 
>> There are no commit since two years, so I'm not sure it's still alive.
> 
> Nevertheless, it is the way forward.
> 
>> I tried to extract the useful code from the script. It depends on the
>> libnet-ldapapi-perl package and the configuration of the machine which
>> is running the LDAP.
> 
> The Debian LDAP can be accessed from any machine, anonymous access
> will only return the public data (including hostname stuff). So you
> shouldn't need to run on db.d.o nor read the config file at all.

Thank you for these infos, I ignored them. :-)

I attached 2 scripts (one in Perl, one in Python) allowing to get the
names of the machines providing packages.debian.org service. I think
some checks about LDAP errors could be added but it's a start.

I guess the perl script could be included in order to fix the current
bug report.

-- 
Stéphane

Attachment: packagemachines.pl
Description: Perl program

#! /usr/bin/python
#
# package python-ldap must be installed

import ldap

    
def get_packages_machines():
    machines = _request_machines_on_ldap()
    packages_machines = []

    for machine in machines:
        details = machine[1]
        try:
           if "packages.debian.org" in details["purpose"][0]:
               packages_machines.append(details["host"][0])
        except KeyError:
           pass

    return packages_machines

def _request_machines_on_ldap():
    l = ldap.initialize("ldap://db.debian.org";)
    l.simple_bind_s("", "")
    ldap_result_id = l.search("dc=debian,dc=org", ldap.SCOPE_SUBTREE, "host=*")
    result_type, result_data = l.result(ldap_result_id, 1)
    l.unbind_s()
    return result_data


if __name__ == "__main__":
    print(get_packages_machines())

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: