Skip to content

mgr/prometheus: Handle empty JSON from orch get-security-config - #65033

Merged
SrinivasaBharath merged 1 commit into
ceph:mainfrom
Nordix:fix-72380-sunnat
Oct 10, 2025
Merged

SrinivasaBharath merged 1 commit into
ceph:mainfrom
Nordix:fix-72380-sunnat

Conversation

@Sunnatillo

@Sunnatillo Sunnatillo commented Aug 14, 2025 •

Copy link
Copy Markdown
Contributor

This PR handles the empty invalid JSON errors from orch get-security-config

Fixes. https://tracker.ceph.com/issues/72380
Issue introduced by this PR: #61468

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 x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

@Sunnatillo

Sunnatillo commented Aug 18, 2025 •

Copy link
Copy Markdown
Contributor Author

PTAL
/cc @rkachach @nizamial09

@Sunnatillo Sunnatillo changed the title mgr/prometheus: Handle empty/invalid JSON from orch get-security-config mgr/prometheus: Handle empty JSON from orch get-security-config Aug 21, 2025
@ljflores
ljflores requested review from a team, nizamial09 and rkachach August 21, 2025 19:14
Comment thread src/pybind/mgr/prometheus/module.py Resolved

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Sunnatillo but I didn't have time to look at this issue in details. But as I can tell, the problem is not with bad json parsing (that's already being captured) but with the logging of the exception. If you check the logs you would see the error:

2025-07-27T22:54:07.624 INFO:tasks.ceph.mgr.x.smithi088.stderr:TypeError: not all arguments converted during string formatting

And this is the real problem. So basically the except Execption is working correctly but then there's another exception raised by logging sentence as the f-string formatting is not working properly with log.exception:

                self.log.exception(f'Failed to setup cephadm based secure monitoring stack: {e}\n',
                                   'Falling back to default configuration')

So the fix has to be in the logging instruction. Plz, can you try by using the following:

except Exception as e:
    self.log.exception(
        'Failed to setup cephadm based secure monitoring stack: %s\n'
        'Falling back to default configuration',
        e
    )

To test quickly the changes you can fake a bad json by setting the out variable directly to an invalid json.

@rkachach rkachach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes LGTM

@Sunnatillo

Copy link
Copy Markdown
Contributor Author

@rkachach @nizamial09 How should we proceed to take this in?

@ljflores

Copy link
Copy Markdown
Member

I've marked it ready for QA. For sure this issue reproduces in the rados suite, so we can verify it with that. Not sure if other testing might be needed.

@rkachach

Copy link
Copy Markdown
Contributor

@ljflores @adk3798 does this tag add the PR for some automated suite or should we add it as part of orch Teuthology testing?

@Sunnatillo

Copy link
Copy Markdown
Contributor Author

Lets get this PR in

@amathuria

Copy link
Copy Markdown
Contributor

@SrinivasaBharath
SrinivasaBharath merged commit 6966e1b into ceph:main Oct 10, 2025
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Mar 20, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Mar 20, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Mar 20, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Mar 21, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Apr 3, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Apr 3, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Apr 10, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request Apr 13, 2026
Add patch for ceph tracker #72380 where the prometheus mgr module
crashes with TypeError due to incorrect f-string usage in exception
logging. Upstream fix: ceph/ceph#65033

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Signed-off-by: Utkarsh Bhatt <[email protected]>
UtkarshBhatthere added a commit to canonical/ceph-containers that referenced this pull request May 1, 2026
Two RookTest failures from PR #94 (run 25206184833):

* prometheus mgr module hits TypeError: not all arguments converted
  during string formatting at module.py:1894. Bug is in upstream Ceph
  v20.2.0 source (fixed on tentacle branch post-tag, ceph/ceph#65033;
  also fixed in v20.2.1). Adapted from MicroCeph patches/0002.

* dashboard fails to load with No module named 'smb'. The smb mgr
  module exists in upstream Tentacle but Ubuntu/Debian do not yet
  ship a ceph-mgr-smb binary package. Drop in a stub satisfying the
  dashboard's import surface (Intent, Simplified, Cluster, JoinAuth,
  Share, UsersAndGroups). Adapted from MicroCeph patches/0003.

Both patches use usr/share/ceph/mgr/... prefix to match our overlay
layout (MicroCeph stages without the usr/ prefix; we don't).

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
UtkarshBhatthere added a commit to canonical/ceph-containers that referenced this pull request May 4, 2026
* Prepare main for Ceph Tentacle
* Fix CephadmTest and RookTest for Tentacle bump
* Install python3-ceph-common alongside cephadm on Tentacle host
* Install ceph-common alongside cephadm to provide ceph daemon user
* test: capture mgr diagnostics on cephadm bootstrap failure
* rock: switch tentacle base to noble + microceph PPA
* rock: shim missing verify_cacrt_content in mgr_util
* rock: shim prometheus TypeError and stub missing smb mgr module
* prometheus mgr module hits TypeError: not all arguments converted
  during string formatting at module.py:1894. Bug is in upstream Ceph
  v20.2.0 source (fixed on tentacle branch post-tag, ceph/ceph#65033;
  also fixed in v20.2.1). Adapted from MicroCeph patches/0002.
* dashboard fails to load with No module named 'smb'. The smb mgr
  module exists in upstream Tentacle but Ubuntu/Debian do not yet
  ship a ceph-mgr-smb binary package. Drop in a stub satisfying the
  dashboard's import surface (Intent, Simplified, Cluster, JoinAuth,
  Share, UsersAndGroups). Adapted from MicroCeph patches/0003.
* rock: pin PPA signing key fingerprint to skip launchpadlib lookup
* rock: pin tentacle PPA with priority always; split nfs-ganesha part
* test: bypass rook 1.19 rgw selector mismatch
* test: update external-cluster fixture paths for rook 1.19
* test: rename csi-rbd-provisioner to indexed form for rook 1.19
* test: lowercase rados namespace name for rook 1.19
* test: pass realm/zonegroup/zone to validate-rgw-endpoint

---------

Signed-off-by: Utkarsh Bhatt <[email protected]>
Co-authored-by: Claude Opus 4.7 <[email protected]>
UtkarshBhatthere added a commit to canonical/microceph that referenced this pull request May 28, 2026
The 0002-fix-prometheus-module-string-formatting-error.patch is already
applied in tentacle-rc ceph (verified in
ceph-mgr-modules-core_20.2.1-0ubuntu1~bpo24.04.1~ppa202605272024_all.deb
from ppa:lmlogiudice/ceph-tentacle-rc). The override-stage scriptlet
fails patch reverse-detection and aborts the build.

Upstream: ceph/ceph#65033
Tracker:  https://tracker.ceph.com/issues/72380

Signed-off-by: Utkarsh Bhatt <[email protected]>
Assisted-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants