Hi, On Fri, Dec 13, 2019 at 05:31:47AM +0600, Judit Foglszinger wrote: > While attempting to import nm-mock.json, several exceptions are raised.
Indeed. And also several things are not exported either.
> 1) for legacy processes it's assumed, that "manager" cannot be null,
> but for example emeritus processes have no AM.
> Attached a patch for that.
Thank you, applied now.
> 2) key errors when looking up people with an email address as lookup_key;
> in most cases this affects the house keeping robot closing processes,
> but also also (currently) two people with @users.alioth.debian.org
> as username, who uploaded statements.
> ---
> File "/tmp/nm.debian.org/backend/export.py", line 144, in import_person
> person._rels["processes"].append(self.import_process(person, pr))
> File "/tmp/nm.debian.org/backend/export.py", line 231, in import_process
> "closed_by": self.people[closed_by] if closed_by else None,
> KeyError: 'nm AT debian.org'
> ---
> As a workaround in the json-file, one can replace the
> redacted (@example.org) email field with the value from the lookup_key:
>
> {
> "username": "__housekeeping__",
> ...
> "lookup_key": "nm AT debian.org",
> - "email": "[email protected]",
> + "email": "nm AT debian.org",
mhh. In this case, shouldn't we directly change the email to be the
same of the lookup_key? Or anyway fix the original data.
Or teach the importer to reverse the mangling.
> 3) key errors when looking up fingerprints for statements
> in non legacy processes
> ----
> File "/tmp/nm.debian.org/backend/export.py", line 263, in import_requirement
> req._rels["statements"].append(self.import_statement(req, stm))
> File "/tmp/nm.debian.org/backend/export.py", line 278, in import_statement
> "fpr": self.fprs[fpr] if fpr else None,
> KeyError: '1234567891234567891234567891234567891234'
> ----
> At the time those statements are imported,
> only fingerprints, that belong to people earlier in the json-file
> are available in the fpr object.
> (For example, if I move myself to the top of the file,
> fpr only consists of my fingerprint).
>
> Importing all fingerprints already in the first (shallow) run
> of import_person() only apparently solves the problem by
> having all fingerprints available and being able to import the whole file.
> But in the end the attempt fails with
> ---
> File "/tmp/nm.debian.org/backend/export.py", line 418, in save
> st.save()
> File "/usr/lib/python3/dist-packages/django/db/models/base.py", line 764, in
> save
> "unsaved related object '%s'." % field.name
> ValueError: save() prohibited to prevent data loss due to unsaved related
> object 'fpr'.
> ---
Doesn't this error reports tha the fpr wasn't previously .save()'d?
I can't probably evaluate your second patch as I don't really know that
piece of code, but I guess yes, the idea is to have multiple runs
through the .json, since the inner data is interrelated.
All of this, while I can't properly test anything locally thanks to
#931677...
--
regards,
Mattia Rizzolo
GPG Key: 66AE 2B4A FCCF 3F52 DA18 4D18 4B04 3FCD B944 4540 .''`.
More about me: https://mapreri.org : :' :
Launchpad user: https://launchpad.net/~mapreri `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia `-
signature.asc
Description: PGP signature

