Problem/Motivation

Since a change in the Drupal core version 11.2.0-rc1 (https://www.drupal.org/project/drupal/issues/3410938), the Update Status Sensor does not report the status correctly.
When an update is available, the intention is to report an INFO status, but now a CRITICAL status is reported.

Proposed resolution

Update the sensor-plugin to support the new enums that the core uses.

This may cause some backward-compatibility issues for older versions of Drupal.

Issue fork monitoring-3541498

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bryandenijs created an issue. See original summary.

bryandenijs’s picture

Status: Active » Needs review
StatusFileSize
new1.37 KB

Here is a patch to fix the issue.

bryandenijs’s picture

StatusFileSize
new2.19 KB

I was a little bit too fast with the patch in #2.

Here is a new version.
Also dit a little bit of code-styling.

berdir’s picture

Status: Needs review » Needs work

Contributions need to be done as merge requests. This will need to be done in a way that supports older core versions as well, similar to #3532529: Support requirement severity enums.

bryandenijs’s picture

Ok Thanks! I will create an updated MR.

bryandenijs’s picture

Status: Needs work » Needs review
fago’s picture

I also ran into this. Testing the fix.

However, this patch will only work with Drupal 11.2+. What made the old constants go away? They should be still defined. Maybe something stopped including the install.inc file where the constants are defined?

bryandenijs’s picture

You are right that the fix only works for 11.2+, so maybe this needs a new major version?

About the old constants: they are still there, but they are deprecated and Core now uses new constants. See the core issue, mentioned in the issue description.

fago’s picture

Status: Needs review » Needs work

The old constants are deprecated, but still available. They should still work.
See https://git.drupalcode.org/project/drupal/-/commit/76dcf5a207d8f96c47508... and https://www.drupal.org/node/3410939

I can report that the patch works, thanks!
However, for merging it I'd think it would be best to make it work in a backwards-compatible way, e.g. using the deprecation helper.. Thus setting needs work for that.

bryandenijs’s picture

Status: Needs work » Needs review

I did not know that method. Thanks for pointing it out!
I updated the Merge Request. Should work now for older versions of Drupal too.

fago’s picture

Status: Needs review » Needs work

Thanks! However, both versions of the code seem to use the same SensorResultInterface constants?

bryandenijs’s picture

Thank you for the review. I don't fully understand what the problem is.

The old method used the
SensorResultInterface, while the new version uses the
SensorResultDataInterface (where the constants are now located).

Also, this interface (SensorResultDataInterface) is not deprecated and is located within the Monitoring module itself, so we should be able to continue using it.

Or am I overlooking something here?

Thanks again!

fago’s picture

Status: Needs work » Reviewed & tested by the community

oops, of course - it's alright. I tested the update patch as well, it still works fine. Thus, this is ready!

  • berdir committed 28fadbca on 8.x-1.x authored by bryandenijs
    fix: #3541498 Update Status Sensor reports CRITICAL when not needed
    
    By...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Quite a bit of code duplication but it's temporary, so I guess that's OK. And yes, no reason for changing our own constants, this isn't a deprecation, but I guess it also doesn't hurt.

Merged.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.