fix: Old / duplicate sensors would never be removed, this is fixed by setting the $type correctly #6044 #6079

Merged
merged 1 commit into from Mar 6, 2017

Conversation

Projects
None yet
5 participants
@laf
Member

laf commented Mar 3, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

  • Have you signed the Contributors agreement - please do NOT submit a pull request unless you have (signing the agreement in the same pull request is fine). Your commit message for signing the agreement must appear as per the docs.
  • Have you followed our code guidelines?

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

Fixes: #6044

$type was being overwritten in many of the included files, we can't fix those properly as it's used to generate the filename. Probably best we don't use such a generic variable name anyway.

@laf laf added the Bug 🐞 label Mar 3, 2017

@mention-bot

This comment has been minimized.

Show comment
Hide comment
@mention-bot

mention-bot Mar 3, 2017

Thank you for submitting a PR @laf! We have found the following @HenocKA, @murrant and @InsaneSplash based on the history of these files to review this PR.

Thank you for submitting a PR @laf! We have found the following @HenocKA, @murrant and @InsaneSplash based on the history of these files to review this PR.

@LibreNMS-CI

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier Mar 3, 2017

The inspection completed: No new issues

The inspection completed: No new issues

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Mar 3, 2017

Member

List of affected files:

charge/apc.inc.php
charge/eatonups.inc.php
charge/netagent2.inc.php
charge/rfc1628.inc.php
charge/sinetica.inc.php
cisco-entity-sensor.inc.php
current/apc.inc.php
current/cyberpower.inc.php
current/digipower.inc.php
current/eatonups.inc.php
current/gamatronicups.inc.php
current/mgeups.inc.php
current/netagent2.inc.php
current/netvision.inc.php
current/powerware.inc.php
current/rfc1628.inc.php
current/sinetica.inc.php
entity-sensor.inc.php
fanspeeds/f5.inc.php
frequencies/apc.inc.php
frequencies/eatonups.inc.php
frequencies/mgeups.inc.php
frequencies/netagent2.inc.php
frequencies/netvision.inc.php
frequencies/powerware.inc.php
frequencies/rfc1628.inc.php
frequencies/sinetica.inc.php
load/netagent2.inc.php
load/rfc1628.inc.php
load/sinetica.inc.php
netscaler.inc.php
openbsd.inc.php
power/rfc1628.inc.php
power/sinetica.inc.php
runtime/apc.inc.php
runtime/sinetica.inc.php
signal/cambium.inc.php
signal/canopy.inc.php
signal/routeros.inc.php
states/pcoweb.inc.php
states/rfc1628.inc.php
temperatures/areca.inc.php
temperatures/cambium.inc.php
temperatures/canopy.inc.php
temperatures/ceraos.inc.php
temperatures/hytera.inc.php
temperatures/ibmnos.inc.php
temperatures/netagent2.inc.php
temperatures/routeros.inc.php
temperatures/saf.inc.php
temperatures/seos.inc.php
temperatures/siklu.inc.php
temperatures/supermicro.inc.php
voltages/apc.inc.php
voltages/areca.inc.php
voltages/ceraos.inc.php
voltages/cyberpower.inc.php
voltages/eatonups.inc.php
voltages/gamatronicups.inc.php
voltages/hytera.inc.php
voltages/linux.inc.php
voltages/mgeups.inc.php
voltages/netagent2.inc.php
voltages/netvision.inc.php
voltages/powerware.inc.php
voltages/rfc1628.inc.php
voltages/routeros.inc.php
voltages/saf.inc.php
voltages/sentry3.inc.php
voltages/siklu.inc.php
voltages/sinetica.inc.php
voltages/unix.inc.php
Member

laf commented Mar 3, 2017

List of affected files:

charge/apc.inc.php
charge/eatonups.inc.php
charge/netagent2.inc.php
charge/rfc1628.inc.php
charge/sinetica.inc.php
cisco-entity-sensor.inc.php
current/apc.inc.php
current/cyberpower.inc.php
current/digipower.inc.php
current/eatonups.inc.php
current/gamatronicups.inc.php
current/mgeups.inc.php
current/netagent2.inc.php
current/netvision.inc.php
current/powerware.inc.php
current/rfc1628.inc.php
current/sinetica.inc.php
entity-sensor.inc.php
fanspeeds/f5.inc.php
frequencies/apc.inc.php
frequencies/eatonups.inc.php
frequencies/mgeups.inc.php
frequencies/netagent2.inc.php
frequencies/netvision.inc.php
frequencies/powerware.inc.php
frequencies/rfc1628.inc.php
frequencies/sinetica.inc.php
load/netagent2.inc.php
load/rfc1628.inc.php
load/sinetica.inc.php
netscaler.inc.php
openbsd.inc.php
power/rfc1628.inc.php
power/sinetica.inc.php
runtime/apc.inc.php
runtime/sinetica.inc.php
signal/cambium.inc.php
signal/canopy.inc.php
signal/routeros.inc.php
states/pcoweb.inc.php
states/rfc1628.inc.php
temperatures/areca.inc.php
temperatures/cambium.inc.php
temperatures/canopy.inc.php
temperatures/ceraos.inc.php
temperatures/hytera.inc.php
temperatures/ibmnos.inc.php
temperatures/netagent2.inc.php
temperatures/routeros.inc.php
temperatures/saf.inc.php
temperatures/seos.inc.php
temperatures/siklu.inc.php
temperatures/supermicro.inc.php
voltages/apc.inc.php
voltages/areca.inc.php
voltages/ceraos.inc.php
voltages/cyberpower.inc.php
voltages/eatonups.inc.php
voltages/gamatronicups.inc.php
voltages/hytera.inc.php
voltages/linux.inc.php
voltages/mgeups.inc.php
voltages/netagent2.inc.php
voltages/netvision.inc.php
voltages/powerware.inc.php
voltages/rfc1628.inc.php
voltages/routeros.inc.php
voltages/saf.inc.php
voltages/sentry3.inc.php
voltages/siklu.inc.php
voltages/sinetica.inc.php
voltages/unix.inc.php

@laf laf merged commit 339cda3 into librenms:master Mar 6, 2017

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@laf laf deleted the laf:issue-6044 branch Mar 6, 2017

@@ -982,7 +982,7 @@ function sensors($types, $device, $valid, $pre_cache = array())
global $config;
foreach ((array)$types as $type) {
echo ucfirst($type) . ': ';
-
+ $sensor_type = $type;

This comment has been minimized.

@murrant

murrant Mar 6, 2017

Member

@laf You should have change $type -> $sensor_type in the foreach :)

@murrant

murrant Mar 6, 2017

Member

@laf You should have change $type -> $sensor_type in the foreach :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment