Repository navigation
tentacle: python-common: multi-line for yaml - #68579
Conversation
Currently when running the command ceph orch ls --export multi-line strings are processed using default interpretation meaning they could be printed with quotations instead of the expected | . This causes a hassle for users who want to copy their specifications to new yaml files as they have to manually modify the yaml to remove the quotes and add | . My code fixes this by modifying the yaml representer to check for multi-line strings and wrapping them in a YamlLiteralString class which will mark the multi-line string to be processed with | . I've also added unit tests. Signed-off-by: Timothy Q Nguyen <[email protected]> (cherry picked from commit 0a73f68)
|
jenkins test api |
|
This PR has been added to wip-yuri2-testing-2026-04-27-1438-tentacle. |
|
This PR has been added to wip-yuri10-testing-20260622.213727-tentacle. |
|
RADOS approved in QA RUN: |
There was a problem hiding this comment.
Automated Backport Parity Review - Backport Deviation Alert
A conflict or unapproved deviation was detected during the simulation of this backport. The code in this PR does not match a clean cherry-pick of the upstream commits.
Deviation in Backport 8cb5269 (cherry-pick of 0a73f68)
Affected File(s)
src/python-common/ceph/tests/test_service_spec.py
Range Diff
Click to expand
--- Original (0a73f686)
+++ Backport (8cb52696)
@@ -12,3 +12,4 @@
to be processed with | . I've also added unit tests.
Signed-off-by: Timothy Q Nguyen <[email protected]>
+(cherry picked from commit 0a73f686c8734e6545fef48275af56502300a4e7)
================================================================================
RANGE DIFF
================================================================================
1: 0a73f686c87 ! 1: 8cb526961c0 python-common: multi-line for yaml
@@ Commit message
to be processed with | . I've also added unit tests.
Signed-off-by: Timothy Q Nguyen <[email protected]>
+ (cherry picked from commit 0a73f686c8734e6545fef48275af56502300a4e7)
## src/python-common/ceph/deployment/service_spec.py ##
@@ src/python-common/ceph/deployment/service_spec.py: def handle_type_error(method: FuncT) -> FuncT:
@@ src/python-common/ceph/tests/test_service_spec.py: from ceph.deployment.service_
)
from ceph.deployment.drive_group import DriveGroupSpec
from ceph.deployment.hostspec import SpecValidationError
-@@ src/python-common/ceph/tests/test_service_spec.py: def test_non_osd_services_do_not_get_default_termination_if_not_provided(spec_da
-
- spec_section = j.get('spec', {})
- assert 'termination_grace_period_seconds' not in spec_section
+@@ src/python-common/ceph/tests/test_service_spec.py: def test_extra_args_handling(y, ec_args, ee_args, ec_final_args, ee_final_args):
+ for args in spec_obj.extra_entrypoint_args:
+ ee_res.extend(args.to_args())
+ assert ee_res == ee_final_args
++
+
+def test_yaml_literal_string_class_represents_multiline_strings_as_literal():
+ multiline_string = "test1\ntest2\n"
@@ src/python-common/ceph/tests/test_service_spec.py: def test_non_osd_services_do_
+
+ assert dumped.startswith('|')
+
++
+def test_yaml_representer_can_handle_multiline_strings_for_export():
+ spec_data = """
+service_type: iscsiHow to proceed:
- Authors (Genuine Conflicts): If this is a genuine conflict requiring manual resolution, ensure your resolution is correct. You must explain the conflict resolution in the commit message (e.g., leave the standard Git
Conflicts:block intact) and include an explanation for changes. - Authors (Need Help?): Reach out to the Component Lead for technical guidance on complex code conflicts.
- Component Leads (Review): Please review the Range Diff(s) above to verify the author's manual conflict resolution is correct for this release branch. If the deviation is intentional, documented, and approved then the component lead or @ceph/ceph-release-manager can bypass this check by commenting
/audit override.
Be familiar with the rules and guidelines for writing backports.
Commit Parity Visualizer
| BACKPORT PR #68579 | SOURCE PR | SOURCE STATUS |
|---|---|---|
| 8cb5269 python-common: multi-line for yaml | PR #68034 | 0a73f68 python-common: multi-line for yaml |
🛟 Need Help?
If you need technical help resolving these issues, please consult with the Component Lead. If you need administrative overrides, please see the #ceph-upstream-releases channel on Slack and request a review from the @ceph/ceph-release-manager.
📋 Component Lead / Release Manager
To override the audit failure, apply releng-audit-override label or comment /audit override.
When you are ready for a new audit, please remove the releng-audit-fail label or comment /audit retest.
CI Run Log: View Workflow Details
Backport of #68034
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.