]> git.apps.os.sepia.ceph.com Git - ceph.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)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 28 Jun 2023 20:48:51 +0000 (16:48 -0400)
commit1bae8b0c0c39246bfc92e8f366ddb9e345cee343
tree37a05db2f8aac02128f05c204b902ec82571ac8c
parent5cc6f0a147247799478556e01b397f3ee6599f2e
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>
src/python-common/ceph/deployment/service_spec.py