Code review comment for lp:~gmb/maas/fix-null-when-releasing-ip-bug-1383668

Revision history for this message
Gavin Panella (allenap) wrote :

I'm not sure we should do this. The API is for use by other programs.
One of those programs is the maas CLI. This message is being changed for
the benefit of the human behind the CLI, but the CLI can also be driven
by another program, and the API is available to any program.

In this exact case the script can check the return code, where HTTP 200
OK means all's well. However, this change would set a precedent that I
don't think we should set: we can't always replace the machine-readable
output with a human-readable message. Having places where the response
is for humans and others where it's for machines would give MAAS an even
more inconsistent API.

Can I suggest a few options?

1. Do all the translation from machine to human in the CLI.

2. If the human message is short, we could add it as a header to the
   response.

3. Return a multipart response with a machine and human part. This would
   cause a break in compatibility, but it's an easy one to implement at
   least.

What do you think?

review: Needs Information

« Back to merge proposal