From 8295b488cc1055f0457db1341448f344b6e97292 Mon Sep 17 00:00:00 2001 From: Morgan Haskel Date: Mon, 9 Mar 2015 16:55:57 -0700 Subject: [PATCH] Revert "(MODULES-661) Add host parameter to psql commands" This reverts commit d92b2545e2b82f2e07a83455710f032a508ee341. Conflicts: spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb --- lib/puppet/provider/postgresql_psql/ruby.rb | 1 - lib/puppet/type/postgresql_psql.rb | 4 -- spec/acceptance/alternative_host_spec.rb | 44 ------------------- .../provider/postgresql_psql/ruby_spec.rb | 13 ------ spec/unit/puppet/type/postgresql_psql_spec.rb | 5 +-- 5 files changed, 2 insertions(+), 65 deletions(-) delete mode 100644 spec/acceptance/alternative_host_spec.rb diff --git a/lib/puppet/provider/postgresql_psql/ruby.rb b/lib/puppet/provider/postgresql_psql/ruby.rb index 62c88c1..7dd69ac 100644 --- a/lib/puppet/provider/postgresql_psql/ruby.rb +++ b/lib/puppet/provider/postgresql_psql/ruby.rb @@ -14,7 +14,6 @@ Puppet::Type.type(:postgresql_psql).provide(:ruby) do command = [resource[:psql_path]] command.push("-d", resource[:db]) if resource[:db] command.push("-p", resource[:port]) if resource[:port] - command.push("-h", resource[:host]) if resource[:host] command.push("-t", "-c", sql) if resource[:cwd] diff --git a/lib/puppet/type/postgresql_psql.rb b/lib/puppet/type/postgresql_psql.rb index a615844..d724cf8 100644 --- a/lib/puppet/type/postgresql_psql.rb +++ b/lib/puppet/type/postgresql_psql.rb @@ -52,10 +52,6 @@ Puppet::Type.newtype(:postgresql_psql) do desc "The name of the database to execute the SQL command against." end - newparam(:host) do - desc "The host to run the PSQL against" - end - newparam(:port) do desc "The port of the database server to execute the SQL command against." end diff --git a/spec/acceptance/alternative_host_spec.rb b/spec/acceptance/alternative_host_spec.rb deleted file mode 100644 index c451f93..0000000 --- a/spec/acceptance/alternative_host_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'spec_helper_acceptance' - -# These tests ensure that postgres commands can be specified by host -# TODO: Setup Postgres on different server and try remote connetions -describe 'postgresql_psql', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do - it 'with a host parameter' do - setup_postgres = <<-EOS - class { 'postgresql::server': - pg_hba_conf_defaults => false, - } - - # For ease of testing, allow anyone to access Postgres - # NEVER DO THIS IN THE REAL WORLD! - postgresql::server::pg_hba_rule { 'allow full yolo access local': - type => 'local', - database => 'all', - user => 'all', - auth_method => 'ident', - order => '000', - } - - postgresql::server::pg_hba_rule { 'allow full yolo access host': - type => 'host', - database => 'all', - user => 'all', - address => '127.0.0.1/32', - auth_method => 'trust', - order => '001', - } - EOS - - run_different_host = <<-EOS - postgresql_psql { 'run against different host': - db => 'postgres', - host => '127.0.0.1', - command => 'select 1', - } - EOS - - apply_manifest(setup_postgres, :catch_failures => true) - apply_manifest(run_different_host, :catch_failures => true) - end - -end \ No newline at end of file diff --git a/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb b/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb index 44a50a4..2282edf 100644 --- a/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb +++ b/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb @@ -79,19 +79,6 @@ describe Puppet::Type.type(:postgresql_psql).provider(:ruby) do provider.run_sql_command("SELECT something") end end - describe "with host string" do - let(:attributes) do { :host => '127.0.0.1' } end - - it "executes with the given host" do - expect(provider).to receive(:run_command).with(["psql", - "-h", "127.0.0.1", - "-t", "-c", - "SELECT something"], - "postgres", "postgres") - - provider.run_sql_command("SELECT something") - end - end context("#run_unless_sql_command") do let(:attributes) do { } end diff --git a/spec/unit/puppet/type/postgresql_psql_spec.rb b/spec/unit/puppet/type/postgresql_psql_spec.rb index 0d895a2..5b73a0f 100644 --- a/spec/unit/puppet/type/postgresql_psql_spec.rb +++ b/spec/unit/puppet/type/postgresql_psql_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Puppet::Type.type(:postgresql_psql), "when validating attributes" do - [:name, :unless, :db, :psql_path, :psql_user, :psql_group, :host].each do |attr| + [:name, :unless, :db, :psql_path, :psql_user, :psql_group].each do |attr| it "should have a #{attr} parameter" do expect(Puppet::Type.type(:postgresql_psql).attrtype(attr)).to eq(:param) end @@ -30,8 +30,7 @@ describe Puppet::Type.type(:postgresql_psql), :unless => Puppet.features.microso :psql_group => "postgres", :cwd => "/var/lib", :refreshonly => :true, - :search_path => [ "schema1", "schema2"], - :host => 'postgres-db-server', + :search_path => [ "schema1", "schema2"] }.each do |attr, value| context attr do let(:attributes) do { attr => value } end