]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr/nfs: convert _cmd_nfs_export_apply to use Responder decorator
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 5 May 2022 20:56:08 +0000 (16:56 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 12 Jan 2023 18:44:11 +0000 (13:44 -0500)
commit59b15dd89e272a770c10a1aa33653b65f8f3a3d0
tree7d9489f483734bc400253ed29fc9aa8c6e74372d
parentea783268522fd8d4b7e293023ea447a6e5f1145e
mgr/nfs: convert _cmd_nfs_export_apply to use Responder decorator

The "export apply" functionality is unusual in that it allows either
one or multiple nested requests to change or create an export.
The previous implementation would concatenate the results of
multiple change operations into a single string. It also would continue
making changes if one case failed, adding the error to the string
and setting a non-zero error code.

The updated version keeps the general behavior but returns structured
JSON (or other formatted data) with one entry per change request.  In
order to accomplish this and match the old behavior as closely as
possible we add an intermediate type (AppliedExportResults) that can
return both the response data (the `to_simplified` method) and track if
there was a failure mixed in with the various updates (the
`mgr_return_value` method).

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/nfs/export.py
src/pybind/mgr/nfs/module.py
src/pybind/mgr/nfs/tests/test_nfs.py