[Pkg-cacti-maint] Bug#889181: cacti changes for PHP7.2 and dep8 tests
Nishanth Aravamudan
nish.aravamudan at canonical.com
Sat Feb 3 06:25:24 UTC 2018
Package: cacti
Version: 1.1.31+ds1-1
Severity: normal
Tags: patch
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu bionic ubuntu-patch
Dear Maintainer,
In Ubuntu, the attached patch was applied to achieve the following:
* debian/patches/php72_count_bc_changes.patch: PHP7.2 has deprecated
count() of non-Countable objects.
* debian/patches/update-cactisql.patch: Update cacti.sql for
readstring to community change.
Note that even with this change, the DEP8 tests fail on Ubuntu 18.04,
with:
Unexpected output in /var/log/cacti/cacti.log:
02/02/2018 16:40:07 - AUTOM8 ERROR: The Network ID: 1 is disabled. You must use the 'force' option to force it's execution.
Which I think might be because we need to pass force to some URL or
check a network enabled box in the script?
Thanks for considering the patch.
*** /tmp/tmp6E1xYI/cacti_1.1.31+ds1-1ubuntu1.debdiff
diff -Nru cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch
--- cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch 1969-12-31 16:00:00.000000000 -0800
+++ cacti-1.1.31+ds1/debian/patches/php72_count_bc_changes.patch 2018-02-02 08:21:41.000000000 -0800
@@ -0,0 +1,106 @@
+Description: PHP7.2 has deprecated count() of non-Countable objects
+Author: Nishanth Aravamudan <nish.aravamudan at canonical.com>
+Origin: upstream, https://github.com/Cacti/cacti/commit/202163bf7c8541f1b2827bdd62c584cc4d25124a.patch
+Bug: https://github.com/Cacti/cacti/issues/1040
+Last-Update: 2018-02-02
+
+--- cacti-1.1.31+ds1.orig/graphs_new.php
++++ cacti-1.1.31+ds1/graphs_new.php
+@@ -757,7 +757,7 @@ function graphs() {
+ $num_input_fields = 0;
+ $num_visible_fields = 0;
+
+- if ($xml_array != false) {
++ if (sizeof($xml_array)) {
+ /* loop through once so we can find out how many input fields there are */
+ foreach ($xml_array['fields'] as $field_name => $field_array) {
+ if ($field_array['direction'] == 'input' || $field_array['direction'] == 'input-output') {
+--- cacti-1.1.31+ds1.orig/lib/api_automation.php
++++ cacti-1.1.31+ds1/lib/api_automation.php
+@@ -760,7 +760,7 @@ function display_new_graphs($rule, $url)
+ * for a dropdown selection
+ */
+ $xml_array = get_data_query_array($rule['snmp_query_id']);
+- if ($xml_array != false) {
++ if (sizeof($xml_array)) {
+ /* loop through once so we can find out how many input fields there are */
+ foreach ($xml_array['fields'] as $field_name => $field_array) {
+ if ($field_array['direction'] == 'input' || $field_array['direction'] == 'input-output') {
+@@ -1898,7 +1898,7 @@ function global_item_edit($rule_id, $rul
+ $xml_array = get_data_query_array($automation_rule['snmp_query_id']);
+ $fields = array();
+
+- if (sizeof($xml_array['fields'])) {
++ if (sizeof($xml_array) && sizeof($xml_array['fields'])) {
+ foreach($xml_array['fields'] as $key => $value) {
+ # ... work on all input fields
+ if (isset($value['direction']) && ($value['direction'] == 'input' || $value['direction'] == 'input-output')) {
+--- cacti-1.1.31+ds1.orig/lib/data_query.php
++++ cacti-1.1.31+ds1/lib/data_query.php
+@@ -27,7 +27,7 @@ function run_data_query($host_id, $snmp_
+
+ /* required for upgrading old versions of cacti */
+ if (!db_column_exists('host', 'poller_id')) {
+- return;
++ return false;
+ }
+
+ /* don't run/rerun the query if the host is down, or disabled */
+@@ -205,7 +205,7 @@ function get_data_query_array($snmp_quer
+
+ if (!file_exists($xml_file_path)) {
+ query_debug_timer_offset('data_query', "Could not find data query XML file at '$xml_file_path'");
+- return false;
++ return array();
+ }
+
+ query_debug_timer_offset('data_query', "Found data query XML file at '$xml_file_path'");
+@@ -1227,7 +1227,7 @@ function get_formatted_data_query_indexe
+ /* in case no unique index is available, fallback to first field in XML */
+ if ($sort_cache['sort_field'] == ''){
+ $snmp_queries = get_data_query_array($data_query_id);
+- if (isset($snmp_queries['index_order'])){
++ if (sizeof($snmp_queries) && isset($snmp_queries['index_order'])){
+ $i = explode(':', $snmp_queries['index_order']);
+ if (sizeof($i) > 0){
+ $sort_cache['sort_field'] = array_shift($i);
+@@ -1385,7 +1385,7 @@ function update_data_query_sort_cache($h
+ }
+
+ /* substitute variables */
+- if (isset($raw_xml['index_title_format'])) {
++ if (sizeof($raw_xml) && isset($raw_xml['index_title_format'])) {
+ $title_format = str_replace('|chosen_order_field|', "|query_$sort_field|", $raw_xml['index_title_format']);
+ } else {
+ $title_format = "|query_$sort_field|";
+--- cacti-1.1.31+ds1.orig/lib/functions.php
++++ cacti-1.1.31+ds1/lib/functions.php
+@@ -1691,7 +1691,7 @@ function get_graph_group($graph_template
+
+ /* a parent must NOT be the following graph item types */
+ if (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types[$graph_item['graph_type_id']])) {
+- return;
++ return array();
+ }
+
+ $graph_item_children_array = array();
+--- cacti-1.1.31+ds1.orig/lib/utility.php
++++ cacti-1.1.31+ds1/lib/utility.php
+@@ -297,7 +297,7 @@ function update_poller_cache($data_sourc
+ $host_fields = $data_template_fields;
+ }
+
+- if (sizeof($outputs)) {
++ if (sizeof($outputs) && sizeof($snmp_queries)) {
+ foreach ($outputs as $output) {
+ if (isset($snmp_queries['fields'][$output['snmp_field_name']]['oid'])) {
+ $oid = $snmp_queries['fields'][$output['snmp_field_name']]['oid'] . '.' . $data_source['snmp_index'];
+@@ -357,7 +357,7 @@ function update_poller_cache($data_sourc
+ $host_fields = $data_template_fields;
+ }
+
+- if (sizeof($outputs)) {
++ if (sizeof($outputs) && sizeof($script_queries)) {
+ foreach ($outputs as $output) {
+ if (isset($script_queries['fields'][$output['snmp_field_name']]['query_name'])) {
+ $identifier = $script_queries['fields'][$output['snmp_field_name']]['query_name'];
diff -Nru cacti-1.1.31+ds1/debian/patches/series cacti-1.1.31+ds1/debian/patches/series
--- cacti-1.1.31+ds1/debian/patches/series 2018-01-05 11:28:12.000000000 -0800
+++ cacti-1.1.31+ds1/debian/patches/series 2018-02-02 08:20:22.000000000 -0800
@@ -2,3 +2,5 @@
enable-system-jqueryui-by-putting-cacti-changes-in-main.css.patch
updating-main.css-for-jquery-1.12.patch
remove-global-mysql-command.patch
+update-cactisql.patch
+php72_count_bc_changes.patch
diff -Nru cacti-1.1.31+ds1/debian/patches/update-cactisql.patch cacti-1.1.31+ds1/debian/patches/update-cactisql.patch
--- cacti-1.1.31+ds1/debian/patches/update-cactisql.patch 1969-12-31 16:00:00.000000000 -0800
+++ cacti-1.1.31+ds1/debian/patches/update-cactisql.patch 2018-01-31 15:29:06.000000000 -0800
@@ -0,0 +1,17 @@
+Description: Update cacti.sql for readstring to community change
+Author: Nishanth Aravamudan <nish.aravamudan at canonical.com>
+Origin: upstream, https://github.com/Cacti/cacti/commit/5ba702f8d302413a581155ec8fe6636ff2674b19
+Forwarded: no
+Last-Update: 2018-01-31
+
+--- a/cacti.sql
++++ b/cacti.sql
+@@ -368,7 +368,7 @@
+ `snmp_id` int(10) unsigned NOT NULL DEFAULT '0',
+ `sequence` int(10) unsigned NOT NULL DEFAULT '0',
+ `snmp_version` varchar(100) NOT NULL DEFAULT '',
+- `snmp_readstring` varchar(100) NOT NULL,
++ `snmp_community` varchar(100) NOT NULL,
+ `snmp_port` int(10) NOT NULL DEFAULT '161',
+ `snmp_timeout` int(10) unsigned NOT NULL DEFAULT '500',
+ `snmp_retries` tinyint(11) unsigned NOT NULL DEFAULT '3',
-- System Information:
Debian Release: buster/sid
APT prefers bionic
APT policy: (500, 'bionic')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.13.0-25-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
--
Nishanth Aravamudan
Ubuntu Server
Canonical Ltd
More information about the Pkg-cacti-maint
mailing list