Dereckson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/265619

Change subject: Ensure /proc/cpuinfo exists before read it
......................................................................

Ensure /proc/cpuinfo exists before read it

The health-check.php script requires two conditions to run:
  - procfs mounted to /proc
  - cpuinfo offered (FreeBSD doesn't offer it for example)

It so makes sense to check if the file exists before to try to open it,
even if the environment expects to be on Linux and with /proc/cpuinfo
available, and stops execution at this stage.

Change-Id: I4e003e8716f272a2a7f64facc564ebe07382969c
---
M w/health-check.php
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/19/265619/1

diff --git a/w/health-check.php b/w/health-check.php
index bcc9de3..52a1b20 100644
--- a/w/health-check.php
+++ b/w/health-check.php
@@ -3,6 +3,11 @@
 
 # Work out the number of physical processors
 
+if ( !file_exists ( '/proc/cpuinfo' ) ) {
+       echo "Can't get CPU information, as procfs isn't mounted or 
/proc/cpuinfo isn't available on this system.\n";
+       exit;
+}
+
 $cpuinfo = file_get_contents( '/proc/cpuinfo' );
 
 # Parse cpuinfo

-- 
To view, visit https://gerrit.wikimedia.org/r/265619
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e003e8716f272a2a7f64facc564ebe07382969c
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Dereckson <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to