Commit graph

24 commits

Author SHA1 Message Date
Dominic Cleal
c3d853d22e (MODULES-2185) Fix withenv execution under Puppet 2.7
When executing a command with environment variables, the withenv helper
under Puppet 2.7 is on Puppet::Util::Execution and on 3.0 to 3.3, it's
on Puppet::Util.
2015-07-02 18:12:28 +01:00
Morgan Haskel
9723b7d040 MODULES-1923 - Use the correct command with Puppet < 3.4 2015-04-09 14:29:36 -07:00
Krzysztof Suszyński
cfbf2f9308 Using enviromental varables to hide actual password in psql commands displayed in output and reports. 2015-03-12 10:57:19 -07:00
Hunter Haugen
a50a16d97d Merge pull request #580 from raphink/dev/replication
Replication type
2015-03-12 10:18:42 -07:00
Raphaël Pinson
76ab6f1160 Add a postgresql_replication_slot type 2015-03-12 18:14:58 +01:00
Morgan Haskel
8295b488cc Revert "(MODULES-661) Add host parameter to psql commands"
This reverts commit d92b2545e2.

Conflicts:
	spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb
2015-03-09 17:00:06 -07:00
Peter Souter
d92b2545e2 (MODULES-661) Add host parameter to psql commands
This allows you to use `postgres_pqsl` commands to be run against a specified host. The ultimate goal being that you can use `puppetlabs-postsgresql` to run against remote instances, especially things such as Amazons RDS service.

This PR will be further extended to do things like allow remote `table_grant` and the like.
2015-03-03 17:13:37 +00:00
Morgan Haskel
5dd5428202 Fix errors with future parser 2014-11-03 16:11:06 -08:00
Dominic Cleal
b7cbe60d4b (MODULES-775) Fix refresh/unless parameter interactions
Interactions between resource refreshes and the 'unless' parameter have been
fixed to follow the behaviour of the 'exec' type.

The 'unless' parameter is now always taken into account, whether in ordinary
operation, during a refresh, or when refreshonly is set to true.  The resource
will not run the SQL command when the 'unless' clause matches a row.

Previously a refresh on a resource would ignore the 'unless' parameter if set
which could cause a failure re-running a command, such as attempting to create
a role that already exists.

The following examples have been fixed:

  * should not run SQL when refreshed and the unless query returns rows
  * with refreshonly should not run SQL when the unless query returns no rows
  * with refreshonly should not run SQL when refreshed and the unless query
    returns rows

This is done by moving the logic for refreshonly and whether to run the SQL
command from the provider into the type, and consolidating it in the
should_run_sql method which is called during 'command' property retrieval
(instead of sync) and during refresh.
2014-06-03 10:25:13 +01:00
Brian Almeida
86f2950248 Add support for port parameter to postgresql::server, fix underlying assumptions that port=5432 2014-04-17 15:09:07 -04:00
Reid Vandewiele
0573c158a2 Fix postgresql_conf quote logic
Things like IP addresses DO need to be in quotes. Fixing regex to reflect
requirement.
2014-03-31 09:29:03 -07:00
Joshua Hoblitt
658e20afb5 use Puppet::Util::Execute.execute with puppet >= 3.4
Resolves this warning on puppet 3.4.2:

    Warning: Puppet::Util::SUIDManager.run_and_capture is deprecated; please
    use Puppet::Util::Execution.execute instead.

This patch also fixes the postgresql_psql provider's broken puppet "4"
support.
2014-01-07 16:12:53 -07:00
Ashley Penney
878bf49617 (FM-486) Fix deprecated Puppet::Util::SUIDManager.run_and_capture
Puppet::Util::SUIDManager.run_and_capture recently changed to
Execution.execute, switch before it blows up and stops working.
2013-11-22 14:45:37 -08:00
Ashley Penney
712e5fc7f4 Merge pull request #284 from 3dna/conf_allows_dots
periods are valid in configuration variables also
2013-10-21 14:26:44 -07:00
Jeremy Kitchen
66ef240614 test and fix for dots breaking config keys 2013-10-18 23:02:11 +00:00
Jeremy Kitchen
38e82ede57 add search_path attribute to postgresql_psql resource
This allows you to set a schema search_path on postgresql_psql
resources, in case you have multiple schemas in your database and the
SQL you are trying to run requires a different path
2013-10-14 22:00:21 +00:00
Ken Barber
59c1cbfbf8 Major rewrite to solve order dependencies and unclear public API
This is a very very large change to the module. It started out as a fix to add
postgresl::server::config_entry, and quickly became a rewrite to fix a lot of
ordering issues inherent in the API.

Since this changes the Public API it is considered a backwards compatible
change.

See the upgrading guide in README.md for more details as to what has been
modified in this patch.

Signed-off-by: Ken Barber <ken@bob.sh>
2013-09-14 06:39:15 +01:00
Rahul Gopinath
1dce6454c8 Pulling in pgconf module from camptocamp/puppet-pgconf
This includes the following changes:
  - Hooking up pgconf module to postgresql to manage postgresql.conf
   - pgconf includes a type and provider for postgresql.conf the provider
     is a simple parsed file following basic ini parsing.
  - Add config_entry.pp which wraps the pgconf module.
  - Replace file_line resources by postgresql::config_entry in beforeservice.pp
  - Adding unit tests for the newly introduced functionality
2013-09-14 06:38:53 +01:00
Hunter Haugen
8919359bca Use boolean for refreshonly
Puppet::Type supports `:boolean => true` to create a
`resource.<property>?` method that is true or false based on the
`:true`, `:false`, `true`, or `false` value of the parameter.

This will allow accurate assesment of the refreshonly attribute for
testing.
2013-08-13 16:18:02 -07:00
Dominic Cleal
afa63ef850 Pass only arrays to Puppet::Util.execute() for Puppet 2.6 compatibility 2013-03-21 18:13:13 +00:00
Ken Barber
501289394a Cleaned up and added unit tests
Signed-off-by: Ken Barber <ken@bob.sh>
2013-02-25 17:50:53 +00:00
Carlos Villela
6f6da927d1 Allow SQL commands to be run against a specific DB
If resource[:db] is set, then it is sent to psql. 

Otherwise, argument is omitted and should not introduce any regression.
2013-02-24 02:50:26 -03:00
Brett Porter
6367e359ea add optional cwd to the postgres_psql command
When the psql command runs from a directory it does not have permission to
access, it outputs an error. This error trips up the unless SQL command,
causing the other SQL commands to run even if not needed. Rather than ignore
stderr (which might hide something else), or use an arbitrary directory like
/tmp, this code sets the cwd to the data directory, which will exist and be
owned by the postgres user. If someone uses the postgres_psql type and
customises the psql_user parameter, they should also set an appropriate cwd.
2012-12-14 23:02:18 +11:00
Chris Price
2a922f104a Initial working implementation of ruby psql type/provider
This commit provides a working implementation of a ruby
type/provider (`postgresql_psql` for handling the PSQL
commands.  This is a little more flexible than doing it
via Exec resources, which is what the `postgresql::psql`
type was doing.

The old type is still present but now includes a
deprecation notification, and all of the other types
that were using the `::psql` type have been ported over
to use the `postgresql_psql` type instead.
2012-11-04 21:47:49 -08:00