[Spacewalk-list] Support for postgresql > 8.4

Boyd, Robert Robert.Boyd at peoplefluent.com
Tue Jul 29 17:42:06 UTC 2014


Also found I needed to change this routine in /usr/bin/spacewalk-setup-postgresql

postgresql_service() {
    POSTGRES_SERVICE=postgresql
    OIFS="$IFS"; IFS=' '; read pgsyn pgformal pgnums <<< "$(psql --version)" ; IFS="$OIFS"
    OIFS="$IFS"; IFS='.'; read pgvermajor pgverminor pgverpoint <<< "${pgnums}" ; IFS="$OIFS"
    case "$pgvermajor" in
        8)
          ;;
        *) POSTGRES_SERVICE=${POSTGRES_SERVICE}-${pgvermajor}${pgverminor}
          ;;
    esac

    if [ -e "$SPACEWALK_TARGET" ] ; then
        case $1 in
            initdb) postgresql-setup initdb ;;
                 *) systemctl $1 ${POSTGRES_SERVICE};;
        esac
    else
        case $1 in
            enable) chkconfig postgresql on ;;
                 *) service ${POSTGRES_SERVICE} $1 ;;
        esac
    fi
}

Robert Boyd
Sr. Systems Engineer
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. Robert.Boyd at PeopleFluent.com<mailto:robert.boyd at peoplefluent.com>


[cid:image001.png at 01CFAB30.8ABD10A0]<http://www.peoplefluent.com/>



Visit: www.peoplefluent.com<http://www.peoplefluent.com/> | Read: Peoplefluent Blog<http://peoplefluent.com/resources/peoplefluent-blog> | Follow: @peoplefluent<http://twitter.com/peoplefluent> | Download: iPad App<http://itunes.apple.com/us/app/peoplefluent/id474251804?mt=8>



From: spacewalk-list-bounces at redhat.com [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Boyd, Robert
Sent: Friday, July 25, 2014 3:52 PM
To: spacewalk-list at redhat.com
Subject: Re: [Spacewalk-list] Support for postgresql > 8.4

Here's what I replaced it with:

sub postgresql_start {
  my $postgres_version = `psql --version`;
  my ( $pName, $Official_Name, $pVersion ) = split " ", $postgres_version;
  my ( $psql_Major,$psql_Minor,$psql_Point) = split /\./, $pVersion ;

SWITCH: {
        if ( $psql_Major =~ /8/) { $psql_service_name = "postgresql"; last SWITCH }
        if ( $psql_Major =~ /9/) { $psql_service_name = "postgresql-".$psql_Major.$psql_Minor; last SWITCH }
     }

    system('service $psql_service_name status >&/dev/null');
    system('service $psql_service start >&/dev/null') if ($? >> 8);
    return ($? >> 8);
}

Monday I'll be trying it out.   I expect to find some issues in shell scripts that need the same kind of version detection.

Robert Boyd
Sr. Systems Engineer
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. Robert.Boyd at PeopleFluent.com<mailto:robert.boyd at peoplefluent.com>


[cid:image001.png at 01CFAB30.8ABD10A0]<http://www.peoplefluent.com/>



Visit: www.peoplefluent.com<http://www.peoplefluent.com/> | Read: Peoplefluent Blog<http://peoplefluent.com/resources/peoplefluent-blog> | Follow: @peoplefluent<http://twitter.com/peoplefluent> | Download: iPad App<http://itunes.apple.com/us/app/peoplefluent/id474251804?mt=8>



From: spacewalk-list-bounces at redhat.com<mailto:spacewalk-list-bounces at redhat.com> [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Coffman, Anthony J
Sent: Friday, July 25, 2014 12:54 PM
To: spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>
Subject: Re: [Spacewalk-list] Support for postgresql > 8.4

Robert - just wanted to let you know I appreciate you blazing this trail.  I'm watching this thread with interest.  I want to make the same move with Postgres but don't have a lot of time to invest in working through these issues.

I think the relevant file is /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm

It's got these hardcoded service references


sub postgresql_start {
    system('service postgresql status >&/dev/null');
    system('service postgresql start >&/dev/null') if ($? >> 8);
    return ($? >> 8);
}


--Tony



From: spacewalk-list-bounces at redhat.com<mailto:spacewalk-list-bounces at redhat.com> [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Boyd, Robert
Sent: Friday, July 25, 2014 11:28 AM
To: spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>
Subject: Re: [Spacewalk-list] Support for postgresql > 8.4

I just re-read the report from 2012 and finally understood what Jan logged against that ticket:

After re-reading that I did the following:

yum deplist spacewalk-postgresql
Loaded plugins: downloadonly, product-id, refresh-packagekit, rhnplugin, security, subscription-manager
This system is receiving updates from Red Hat Subscription Management.
This system is receiving updates from RHN Classic or Red Hat Satellite.
rhel-6-server-extras-rpms                                                                                                                            | 2.6 kB     00:00
rhel-6-server-optional-rpms                                                                                                                          | 3.5 kB     00:00
rhel-6-server-rhn-tools-rpms                                                                                                                         | 2.9 kB     00:00
rhel-6-server-rpms                                                                                                                                   | 3.7 kB     00:00
rhel-6-server-supplementary-rpms                                                                                                                     | 3.7 kB     00:00
Finding dependencies:
package: spacewalk-postgresql.noarch 2.2.2-1.el6
  dependency: /usr/bin/psql
   Unsatisfied .  dependency
  dependency: postgresql >= 8.4
   provider: postgresql93.x86_64 9.3.4-1PGDG.rhel6
   provider: postgresql93.x86_64 9.3.3-1PGDG.rhel6
   provider: postgresql93.x86_64 9.3.5-1PGDG.rhel6
  dependency: postgresql-contrib >= 8.4
   provider: postgresql93-contrib.x86_64 9.3.4-1PGDG.rhel6
   provider: postgresql93-contrib.x86_64 9.3.5-1PGDG.rhel6
   provider: postgresql93-contrib.x86_64 9.3.3-1PGDG.rhel6
  dependency: spacewalk-common = 2.2.2-1.el6
   provider: spacewalk-common.noarch 2.2.2-1.el6
  dependency: perl(DBD::Pg)
   provider: perl-DBD-Pg.x86_64 2.15.1-3.el6
   provider: perl-DBD-Pg.x86_64 2.15.1-4.el6_3
   provider: perl-DBD-Pg.x86_64 2.15.1-4.el6_3
   provider: perl-DBD-Pg.x86_64 2.15.1-3.el6
  dependency: spacewalk-backend-sql-postgresql
   provider: spacewalk-backend-sql-postgresql.noarch 2.2.43-1.el6
  dependency: spacewalk-java-postgresql
   provider: spacewalk-java-postgresql.noarch 2.2.123-1.el6

After this I manually selected the listed items:  yum install postgresql93-contrib spacewalk-common perl-DBD-Pg spacewalk-backend-sql-postgresql spacewalk-java-postgresql

If Jan's statement about the master package is correct then I've successfully installed all of the components.

I found the messages from the list about taking care of the jdbc and did all those fixes too.
>From Paul Robert Marino:

Ok three things here

1) install the PostgreSQL 8 libraries and JDBC driver

2) make sure the PostgreSQL 9.2 JDBC driver is installed

3)  fix the symlink for the jdbc driver to point to the the 9.2 version here is where it points to by default "

# ls -l /usr/share/java/postgresql-jdbc.jar

lrwxrwxrwx. 1 root root 44 Nov  5  2012

/usr/share/java/postgresql-jdbc.jar ->

/usr/share/java/postgresql-8.4-703.jdbc4.jar

"

you need to point it to the PostgreSQL 9.2 JDBC driver instead

It would be nice if going forward all of this information is collected in 1 place as a set of notes for those choosing to install spacewalk with postgresql v9 or greater.  Unless we're only interested in everyone who follows after us having to feel the same pains.

Now I'm trying to initialize spacewalk and here's what I get:

spacewalk-setup --disconnected --answer-file=answer-files/spacewalk-configure
* Loading answer file: answer-files/spacewalk-configure.
* Setting up SELinux..
** Database: Setting up database connection for PostgreSQL backend.
** Database: Installing the database:
** Database: This is a long process that is logged in:
** Database:   /var/log/rhn/install_db.log
*** Progress: #
Could not install database.
[root at rdcengsw01 ~]# less /var/log/rhn/install_db.log
error reading information on service postgresql: No such file or directory
[root ~]# grep "error reading information" `which spacewalk-setup`
[root ~]# chkconfig --list | grep post
postfix         0:off   1:off   2:on    3:on    4:on    5:on    6:off
postgresql-9.3  0:off   1:off   2:on    3:on    4:on    5:on    6:off
udev-post       0:off   1:on    2:on    3:on    4:on    5:on    6:off

It looks like to me that the install script supports postgresql version 8.4 ONLY.  Has anyone actually done a straight install (not an upgrade of postgresql ) of spacewalk with postgresql v9.*?

Am I going to have to do what Jonathan says to install the 8.4 postgresql  package(s) and then hide the binaries?  This seems really ridiculously complicated.  It can't possibly be that involved to change the perl code that's looking for the postgres components to have it check for the right names for a higher version.  It would be fairly easy to set up a table to have it check for any version of postgresql, extract the version number and select where to find the files necessary based on the version.

I'll be happy to have a go at it if I can figure out where the routines are that handle that.  At least perl is in my skillset.

Robert Boyd
Sr. Systems Engineer
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. Robert.Boyd at PeopleFluent.com<mailto:robert.boyd at peoplefluent.com>


[cid:image001.png at 01CFAB30.8ABD10A0]<http://www.peoplefluent.com/>



Visit: www.peoplefluent.com<http://www.peoplefluent.com/> | Read: Peoplefluent Blog<http://peoplefluent.com/resources/peoplefluent-blog> | Follow: @peoplefluent<http://twitter.com/peoplefluent> | Download: iPad App<http://itunes.apple.com/us/app/peoplefluent/id474251804?mt=8>



From: spacewalk-list-bounces at redhat.com<mailto:spacewalk-list-bounces at redhat.com> [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Jonathan Hoser
Sent: Thursday, July 24, 2014 11:00 AM
To: spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>
Subject: Re: [Spacewalk-list] Support for postgresql > 8.4

Hi Robert,

I faced the same issues (I think) - if I remember correctly;

I think I faked it,
by installing Postgres 8.x (from the default repos)
then getting 9.1 (for me) from postgres-repos

and then (re-)moving/hiding the 8.4 binaries.
Needed to take care of a bunch of Jars (9.x connectors etc)
but that was it...

If you want more details,
I might be able to tell you on Monday...
Best
-Jonathan

On 07/24/2014 04:38 PM, Boyd, Robert wrote:
Bedankt  for the suggestion Andreas,

It appears that someone previously - in 2012 logged a report about this very same problem with the installation procedure.

The installation guide on the wiki states:  "Spacewalk uses database server to store its primary data. It supports either PostgreSQL (version 8.4 and higher) or Oracle RDBMS (version 10g or higher)."  Unfortunately the rpm needs some help to differentiate when something higher than 8.4 is actually installed.   As far as I can tell from what I read in the response to the bug report, the problem is that the RPM is looking for 8.4 specific files and needs to be updated to include handling the changes implemented for 9 and above.

Creating and managing RPMs is not in my current skillset - I would rather not spend my time learning how to do that when I won't be doing that as a regular thing.  It looks like I'd have to find the source of the spacewalk rpm to discover exactly how it's coded and how it's specifying the postgresql dependencies.  Then I could put together a fakeout rpm as a companion to the postgresql9x rpms that would provide the missing metadata to fake out the spacewalk rpm.

Seems like it would be a much easier effort for someone already well familiar with the spacewalk rpm construction to make the mods necessary to handle postgresql9x.

Robert Boyd
Sr. Systems Engineer
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. Robert.Boyd at PeopleFluent.com<mailto:robert.boyd at peoplefluent.com>


[cid:image001.png at 01CFAB30.8ABD10A0]<http://www.peoplefluent.com/>



Visit: www.peoplefluent.com<http://www.peoplefluent.com/> | Read: Peoplefluent Blog<http://peoplefluent.com/resources/peoplefluent-blog> | Follow: @peoplefluent<http://twitter.com/peoplefluent> | Download: iPad App<http://itunes.apple.com/us/app/peoplefluent/id474251804?mt=8>



From: spacewalk-list-bounces at redhat.com<mailto:spacewalk-list-bounces at redhat.com> [mailto:spacewalk-list-bounces at redhat.com] On Behalf Of Andreas Dijkman
Sent: Thursday, July 24, 2014 3:12 AM
To: spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>
Subject: Re: [Spacewalk-list] upgrading postgres (8.4 > 9.x) on the spacewalk server ?

Hi,

The RPM isn't actually looking at the file but at the file specs of all available RPM's. You need to install and rpm that provides the binary /usr/bin/psql in it's metadata. You could build an metadata-only-rpm that depends on all the postgresql-9.x-stuff and provides the necessary files in it's metadata and secretly creates symlinks underneath.

Met vriendelijke groet,

Andreas Dijkman
Oracle Technical Consultant
Phone: +31(0)50-210 0132 | Mobile: +31(0)6-8115 2982
Cygnis<http://www.cygnis.nl/> | Stationsweg 3B | 9726 AC Groningen
Op maandag afwezig

On 23 Jul, 2014, at 23:42 , Boyd, Robert <Robert.Boyd at peoplefluent.com<mailto:Robert.Boyd at peoplefluent.com>> wrote:

I tried changing the link for /usr/bin/psql to directly link to the binary.  That didn't help.

I tried removing the link and copying the binary to /usr/bin/psql -- that didn't help either.

I take it this means that the error message I'm getting isn't telling me the truth about what the real error is.

Robert Boyd
Sr. Systems Engineer
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. Robert.Boyd at PeopleFluent.com<mailto:Robert.Boyd at PeopleFluent.com>

-----Original Message-----
From: Boyd, Robert
Sent: Wednesday, July 23, 2014 5:33 PM
To: 'spacewalk-list at redhat.com<mailto:spacewalk-list at redhat.com>'
Subject: RE: [Spacewalk-list] upgrading postgres (8.4 > 9.x) on the spacewalk server ?

I'm attempting an install of spacewalk 2.2 using postgresql-9.3.

I installed and manually configured postgresql.

When I attempt to install spacewalk I get this error:

 yum install spacewalk-postgresql

 ... many dependencies resolved ... etc ...

 Error: Package: spacewalk-postgresql-2.2.2-1.el6.noarch (spacewalk)
          Requires: /usr/bin/psql

However there is clearly something there:

[root ~]# ll /usr/bin/psql
lrwxrwxrwx. 1 root root 28 Jul 21 12:35 /usr/bin/psql -> /etc/alternatives/pgsql-psql

[root ~]# ll /etc/alternatives/pgsql-psql
lrwxrwxrwx. 1 root root 23 Jul 21 12:35 /etc/alternatives/pgsql-psql -> /usr/pgsql-9.3/bin/psql

[root ~]# ll /usr/pgsql-9.3/bin/psql
-rwxr-xr-x. 1 root root 447560 Mar 18 03:19 /usr/pgsql-9.3/bin/psql

What is this package expecting to find there?  Is a symbolic link not good enough?  Can I fake it out by copying over the real binary or changing the link to point directly to the binary instead of an intermediate link?


Robert Boyd
Sr. Systems Engineer
PeopleFluent
p. 919-645-2972 | c. 919-306-4681
e. Robert.Boyd at PeopleFluent.com<mailto:Robert.Boyd at PeopleFluent.com>

_______________________________________________
Spacewalk-list mailing list
Spacewalk-list at redhat.com<mailto:Spacewalk-list at redhat.com>
https://www.redhat.com/mailman/listinfo/spacewalk-list



--

Jonathan Hoser, M.Sc.

Institute of Bioinformatics and System Biology



WWW: http://mips.helmholtz-muenchen.de



________________________________
Helmholtz Zentrum München
Deutsches Forschungszentrum für Gesundheit und Umwelt (GmbH)
Ingolstädter Landstr. 1
85764 Neuherberg
www.helmholtz-muenchen.de<http://www.helmholtz-muenchen.de>
Aufsichtsratsvorsitzende: MinDir´in Bärbel Brumme-Bothe
Geschäftsführer: Prof. Dr. Günther Wess, Dr. Nikolaus Blum, Dr. Alfons Enhsen
Registergericht: Amtsgericht München HRB 6466
USt-IdNr: DE 129521671
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20140729/d2c1b24d/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 5228 bytes
Desc: image001.png
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20140729/d2c1b24d/attachment.png>


More information about the Spacewalk-list mailing list