Showing with 28 additions and 6 deletions.
  1. +8 −0 CHANGELOG.md
  2. +6 −0 README.md
  3. +12 −4 lib/facter/puppet_status_check.rb
  4. +1 −1 lib/shared/puppet_status_check.rb
  5. +1 −1 metadata.json
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v0.9.1](https://github.com/puppetlabs/puppetlabs-puppet_status_check/tree/v0.9.1) - 2024-05-10

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_status_check/compare/v0.9.0...v0.9.1)

### Fixed

- Fix broken fact generation when unable to run pg_config on primary [#4](https://github.com/puppetlabs/puppetlabs-puppet_status_check/pull/4) ([h0tw1r3](https://github.com/h0tw1r3))

## [v0.9.0](https://github.com/puppetlabs/puppetlabs-puppet_status_check/tree/v0.9.0) - 2024-05-02

[Full Changelog](https://github.com/puppetlabs/puppetlabs-puppet_status_check/compare/f6d5d880a989fad41190a0df43e8dc0a34713df2...v0.9.0)
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ The default fact population will not perform checks related to puppet infrastruc
puppet_status_check::role: primary
```

Optionally define the path to `pg_config` if it is not in the standard path.

```
puppet_status_check::pg_config_path: /usr/pgsql-16/bin/pg_config
```

### Disable

To completely disable the collection of `puppet_status_check` facts, uninstall the module or [classify the module](#class-declaration) with the `enabled` parameter:
Expand Down
16 changes: 12 additions & 4 deletions lib/facter/puppet_status_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@

{ S0007: PuppetStatusCheck.filesystem_free(data_dir) >= 20 }
rescue StandardError => e
Facter.warn("Error in fact 'puppet_status_check.:S0007' when checking postgres info: #{e.message}")
Facter.warn("Error in fact 'puppet_status_check.S0007' when checking postgres info: #{e.message}")
Facter.debug(e.backtrace)
next
{ S0007: false }
end
end

Expand Down Expand Up @@ -87,8 +87,15 @@
next unless ['primary', 'postgres'].include?(PuppetStatusCheck.config('role'))

# Is the pe-postgres Service Running and Enabled
service_name = PuppetStatusCheck.postgres_service_name
{ S0011: PuppetStatusCheck.service_running_enabled(service_name) }
begin
service_name = PuppetStatusCheck.postgres_service_name
status = PuppetStatusCheck.service_running_enabled(service_name)
rescue StandardError => e
Facter.warn("Error in fact 'puppet_status_check.S0011' failed to get service name: #{e.message}")
Facter.debug(e.backtrace)
end

{ S0011: status ? true : false }
end

chunk(:S0012) do
Expand Down Expand Up @@ -263,6 +270,7 @@
rescue StandardError => e
Facter.warn("Error in fact 'puppet_status_check.S0029' when querying postgres: #{e.message}")
Facter.debug(e.backtrace)
{ S0029: false }
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/shared/puppet_status_check.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def psql_return_result(sql, psql_options = '')
end

def postgresql_version
@pg_version ||= pg_config('version').match(%r{PostgreSQL (\d+)\.(\d+) })
@pg_version ||= pg_config('version')&.match(%r{PostgreSQL (\d+)\.(\d+)})
end

def pg_major_version
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-puppet_status_check",
"version": "0.9.0",
"version": "0.9.1",
"author": "puppetlabs",
"summary": "A Puppet Module to Promote Preventative Maintenance and Self Service",
"license": "Apache-2.0",
Expand Down