]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
python-common: add an ArgumentSpec type for handling args
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 17 May 2023 17:49:23 +0000 (13:49 -0400)
committerAdam King <adking@redhat.com>
Thu, 31 Aug 2023 17:35:15 +0000 (13:35 -0400)
commit0f14e74abbcd01775d79d89f6b6e8f1df3f7ee95
tree006309871a0f1026652a08b4c962ae0996931539
parenta787ebf4e965aeb278027f560ebc5b748b7c9877
python-common: add an ArgumentSpec type for handling args

Add a new ArgumentSpec type to the deployment package. The
ArgumentSpec serves a dual purpose:
* to allow more advanced configuration of extra arguments
* to keep backwards compatibility with string-based args

The previous versions of cephadm supported supplying extra container and
entrypoint arguments for fine-tuning of services and creating custom
containers. However, this mode assumed that spaces in an argument
always meant that the argument should be split into two parts:
"--foo bar" becomes `["--foo", "bar"]`. In some cases there's a good
reason to keep spaces as in "--title=My Little Cluster". When
an argument is expressed as a single string the ArgumentSpec is
designed to retain the existing behavior. When an argument is
expressed as a JSON object then you can explicitly express if
you want the argument split on spaces or not (not split is the default).

The alternative was to keep using strings but add some level of
shell-style quoting. This was discussed but deemed complex and
difficult to read in YAML. Round tripping that data is also challenging.
The JSON object approach also allows for future fields to be added
providing for possible extensibility.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 1bae8b0c0c39246bfc92e8f366ddb9e345cee343)
src/python-common/ceph/deployment/service_spec.py