Skip to content

Commit

Permalink
Allow ovirt to implement their own pg version check
Browse files Browse the repository at this point in the history
This doesn't fix the following bug but allows them to implement their
own adapter that opts-out of the manageiq pg version check and instead
implement their own via a check_version, something like this:

```ruby
module ActiveRecord
  module ConnectionHandling # :nodoc:
    def ovirt_postgresql_connection(config)
      conn_params = config.symbolize_keys
      ...rest of the existing rails 5.1 pg adapter method until...
      ConnectionAdapters::OvirtPostgreSQLAdapter.new(nil, logger, conn_params, config)
    end
  end
  module ConnectionAdapters
    class OvirtPostgreSQLAdapter < PostgreSQLAdapter
      def check_version
        raise "AAAAA" if postgresql_version > XXX
      end
    end
  end
end
```

https://bugzilla.redhat.com/show_bug.cgi?id=1734770
  • Loading branch information
jrafanie committed Aug 1, 2019
1 parent 682f4df commit b3f3f57
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config/initializers/postgres_required_versions.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend Module.new {
def initialize(*args)
super
check_version if respond_to?(:check_version)
end

def check_version
msg = "The version of PostgreSQL being connected to is incompatible with #{Vmdb::Appliance.PRODUCT_NAME} (10 required)"

if postgresql_version < 90500
Expand Down

0 comments on commit b3f3f57

Please sign in to comment.