Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve detection of postgresql conf dir and data dir #901

Merged
merged 1 commit into from
Aug 10, 2016

Conversation

stevendanna
Copy link
Contributor

Redhat conf_dir detection was regressed in 57d7275 which inadvertently
removed the setting of @conf_dir. Any attempt to use the postgres
resource on RHEL would rain an exception:

inspec> postgres.data_dir
TypeError: no implicit conversion of nil into String

Further, the redhat detection code appears to assume that RHEL always
uses versioned data directories. This however, does not appear to be the
case:

$ cat /etc/redhat-release
CentOS release 6.7 (Final)
$ sudo ls /var/lib/pgsql/
backups  data  pgstartup.log

The code now can handle both versioned and un-versioned directory
formats on RHEL. Further, it provides diagnostic warnings about
uncertainty in the discovered data directories and configuration
directories.

Fixes #494

Signed-off-by: Steven Danna steve@chef.io

@@ -3,6 +3,7 @@
# author: Dominik Richter
# author: Christoph Hartmann
# license: All rights reserved
require 'resources/directory'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do not need a require here, since its available by default via inspec.directory

@chris-rock
Copy link
Contributor

This is a great addition @stevendanna

Redhat conf_dir detection was regressed in 57d7275 which inadvertently
removed the setting of @conf_dir. Any attempt to use the postgres
resource on RHEL would rain an exception:

    inspec> postgres.data_dir
    TypeError: no implicit conversion of nil into String

Further, the redhat detection code appears to assume that RHEL always
uses versioned data directories. This however, does not appear to be the
case:

    $ cat /etc/redhat-release
    CentOS release 6.7 (Final)
    $ sudo ls /var/lib/pgsql/
    backups  data  pgstartup.log

The code now can handle both versioned and un-versioned directory
formats on RHEL. Further, it provides diagnostic warnings about
uncertainty in the discovered data directories and configuration
directories.

Signed-off-by: Steven Danna <steve@chef.io>
@chris-rock chris-rock changed the title WIP: Improve detection of postgresql conf dir and data dir Improve detection of postgresql conf dir and data dir Aug 10, 2016
@chris-rock chris-rock merged commit 18079f5 into master Aug 10, 2016
@chris-rock chris-rock deleted the ssd/pgconf-location branch August 10, 2016 17:04
@chris-rock chris-rock modified the milestone: 0.30.0 Aug 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants