Skip to content

Commit bc0c64b

Browse files
phumpalmajormoses
authored andcommitted
metric-postgres-statsdb: maintain backwards compatibility
The `append` alias is only available if ActiveRecord is loaded _or_ sensu is running ruby-2.5.1. This change maintains backwards compatibility with non-EOL Rubies. **Before** ``` Check failed to run: undefined method `append' for []:Array, ["/opt/sensu/.rvm/gems/ruby-2.4.1/gems/sensu-plugins-postgres-2.3.0/bin/metric-postgres-statsdb.rb:104:in `run'", "/opt/sensu/.rvm/gems/ruby-2.4.1/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:58:in `block in <class:CLI>'"] ``` **After** ``` CheckPostgres OK: Server version: {"version"=>"PostgreSQL 11.1 (Ubuntu 11.1-1.pgdg18.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0, 64-bit"} ```
1 parent d2497f2 commit bc0c64b

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44
This CHANGELOG follows the format listed [here](https://github.com/sensu-plugins/community/blob/master/HOW_WE_CHANGELOG.md).
55

66
## [Unreleased]
7+
- metric-postgres-statsdb.rb: Change append to push to maintain compatibility w/ non-EOL Rubies
78

89
## [2.3.0] - 2018-12-08
910
### Added

bin/metric-postgres-statsdb.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def run
101101
params = []
102102
unless config[:all_databases]
103103
query += ' WHERE datname = $1'
104-
params.append config[:database]
104+
params.push config[:database]
105105
end
106106

107107
con.exec_params(query, params) do |result|

0 commit comments

Comments
 (0)