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
[postgresql] Collect data for postgreSQL from RHSCL #1118
[postgresql] Collect data for postgreSQL from RHSCL #1118
Conversation
There was an idea to have a child class of |
sos/plugins/postgresql.py
Outdated
def setup(self): | ||
if self.is_installed('postgresql'): | ||
self.pghome = self.get_option("pghome") | ||
else: # SCL postgreSQL is installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch looks good to me. Just one question, isn't a good idea to check if rh-postgresql95-postgresql-server is installed as you did in line 119?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class can be enabled either by:
- presence of either
postgresql
orrh-postgresql95-postgresql-server
package (plugin/class is enabled by default when a package frompackages
is present, or when a file fromfiles
is present) - see https://github.com/sosreport/sos/pull/1118/files#diff-93be9976582cadc41ed1cec376205196R116 and https://github.com/sosreport/sos/blob/master/sos/plugins/__init__.py#L99-L102 . In this case, and ifpostgresql
isnt installed, we can deducerh-postgresql95-postgresql-server
is installed. - or this class can be enabled manually, e.g. via cmdline option
-o postgres
. Then potentially neither package can be present. In that case, we should rather take default postgres data as the default option. So we should rather revert the test (usescl
commands only whenscl
installed, otherwise default to normalpostgres
).
The difference is imho small, leaving on @bmr-cymru opinion if it makes sense to improve it that way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmoravec right, what happens if we have both installed? Looks like, it will use the postgresql, which I believe is not correct. A possible solution is invert the if logic, like if self.is_installed('rh-postgresql95-postgresql-server') else postgresql. @sandrobonazzola
cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@localhost ~]# rpm -qa | grep -i postgres
postgresql-jdbc-9.2.1002-5.el7.noarch
rh-postgresql95-postgresql-libs-9.5.7-2.el7.x86_64
postgresql-server-9.2.23-1.el7_4.x86_64
rh-postgresql95-scldevel-2.2-2.el7.x86_64
postgresql-9.2.23-1.el7_4.x86_64
rh-postgresql95-postgresql-server-9.5.7-2.el7.x86_64
rh-postgresql95-runtime-2.2-2.el7.x86_64
postgresql-libs-9.2.23-1.el7_4.x86_64
collectd-postgresql-5.7.2-1.el7.x86_64
rh-postgresql95-postgresql-9.5.7-2.el7.x86_64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, this does not look right to me.
Having separate pghome
and sclpghome
plugin options is a bit of an ugly hack, and not very nice for users to try to understand.
I think it would be better to revive the SCLPluign
mixin concept from PR #900 than to attempt to solve this in an ad-hoc and plugin specific fashion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to make this work with SCLPlugin if we can - I don't like the proliferation of hacks that are starting to accumulate here.
sos/plugins/postgresql.py
Outdated
def setup(self): | ||
if self.is_installed('postgresql'): | ||
self.pghome = self.get_option("pghome") | ||
else: # SCL postgreSQL is installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, this does not look right to me.
Having separate pghome
and sclpghome
plugin options is a bit of an ugly hack, and not very nice for users to try to understand.
I think it would be better to revive the SCLPluign
mixin concept from PR #900 than to attempt to solve this in an ad-hoc and plugin specific fashion.
fc15429
to
a70b6ff
Compare
Related to sosreport#900 and sosreport#1090 Original author: Bohuslav Kabrda <bkabrda@redhat.com> Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
Collect postgreSQL data also when postgreSQL is installed from Red Hat Software Collections. Resolves: sosreport#1090 Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
a70b6ff
to
06adcb2
Compare
So did this miss sos 3.5? |
Collect postgreSQL data also when postgreSQL is installed from
Red Hat Software Collections.
Resolves: #1090
Signed-off-by: Pavel Moravec pmoravec@redhat.com
Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines