Commit graph

60 commits

Author SHA1 Message Date
Spenser Gilliland
457f80bfe4 Syntax Fix 2012-12-21 17:26:48 -06: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
9febf9a6ed Merge pull request #46 from cprice-puppet/feature/master/refactor-default-version-fact
Rework `postgres_default_version` fact
2012-12-11 07:36:42 -08:00
Florin Broasca
b02556f96c Fix default version for Ubuntu and Debian 2012-12-09 23:56:27 +02:00
Chris Price
97af59e701 Fix GPG key for yum.postgresl.org
The GPG key for yum.postgresql.org was in the wrong directory,
and as written, would have only supported postgres 9.2 anyway.

I looked at the yum rpms for a few other versions besides 9.2,
and they appear to be using the same GPG key.  So this commit
assumes that they all are doing so, and it sets things up
accordingly.  Hopefully this will make the yumrepo support
compatible with other versions of postgres besides 9.2, but I
haven't added that to the actual test matrix yet.
2012-12-07 11:34:30 -08:00
Chris Price
208b663ad1 Rework postgres_default_version fact
This commit fixes up the `postgres_default_version` fact so that
it doesn't use apt/yum (slow), and instead just has a hard-coded
list of default postgres versions for various OS versions.  We
will need to add new OS versions to this fact over time, but that
seems preferable to the previous implementation which was causing
slower puppet runs on all nodes (regardless of whether they were
actually using postgres or not).
2012-12-07 10:40:18 -08:00
Chris Price
afd8e90dd5 Fix to 'require' for database_grant 2012-12-06 14:35:42 -08:00
Chris Price
228e5c5337 Cleanup and move control of version into params
Thanks to some tricks I learned from Nan Liu and Dan Bode, I was
able to figure out a way to move all of the new version-related stuff
back into the params class, and clean up some of the if/_real stuff.

Basic tests for centos6 + pg 9.2 are passing.
2012-12-04 14:12:41 -08:00
Chris Price
18167c7a3e Merge platform.pp back into params.pp
Nan showed me a trick that will let us keep all of that param stuff
inside of params.pp, make it a parameterized class, and still support
the ability for users to specify a custom (non-system-default) pg
version.  This commit takes the first step towards that pattern by
consolidating platform.pp and params.pp.  (Everything old is new again!)
2012-12-04 14:12:34 -08:00
Chris Price
fa24f24397 Re-add support for managing yumrepo
This commit creates a new class called `package_source_info`,
which has some initial framework for managing the postgresql.org
yumrepo.  It also serves as a container for the 'version'
variable that is needed by the 'platform' class in order to
use other versions of postgres besides the system default.
2012-12-02 23:06:36 -08:00
Chris Price
663c779309 A few minor fixes to get tests passing again 2012-12-02 22:05:57 -08:00
Chris Price
de45945aff Merge ::paths and ::packages into one class, called ::platform. 2012-12-02 20:59:18 -08:00
Chris Price
90ed7aaf6d Working on getting ubuntu specs passing again
The service provider / status stuff got a little broken during
the refactors.  This should mostly fix it but there is still
one spec failing, and I will probably also refactor the
paths.pp and packages.pp into a single file together eventually.
2012-12-02 20:56:36 -08:00
Etienne Pelletier
d1025e90ef Removed references to postgresql::paths in class params. 2012-12-02 20:56:36 -08:00
Etienne Pelletier
33add5e10a Removed postgresql::version class and moved version info to init.pp. 2012-12-02 20:56:29 -08:00
Etienne Pelletier
db1a34e7ea Removed references to $postgresql::paths in class params. 2012-12-02 20:54:39 -08:00
Etienne Pelletier
ca701b303c Removed repo class. 2012-12-02 20:54:39 -08:00
Chris Price
2a108abe8b Fix paths 2012-12-02 20:54:39 -08:00
Etienne Pelletier
1fe9559bbe Refactored multi-version support. 2012-12-02 20:54:33 -08:00
Etienne Pelletier
a5d3de2dc4 Pulled repository stuff out of params.
Lint cleanup.
2012-12-02 20:49:47 -08:00
Chris Price
b9a51be36e Fix paths 2012-12-02 20:49:47 -08:00
Etienne Pelletier
8e96959ca8 Added easier support for Postgresql 9.0 (on RedHat platforms) 2012-12-02 20:49:47 -08:00
Chris Price
1b82be0f89 A little more framework for CentOS pg9 testing 2012-12-02 20:47:04 -08:00
Chris Price
df92c96791 Refactor tests and add CentOS6 image
This commit does a fairly major refactor of how the spec tests
are laid out.  The main goal was to make it easier to run
a subset of the tests--e.g., the ability to only run tests
on a single OS via a simple rspec command.

The test logic is now defined in some shared examples in the
`support` directory.  There are now spec folders for each
distro, which contain some stubs to include the shared examples
as well as a Vagrantfile for the particular distro.

Also, the system-default postgres package tests now run
successfully against the CentOS6 VM that is defined by the
Vagrantfile.
2012-12-02 15:28:25 -08:00
Chris Price
76fcf269d8 Merge branch 'master' into cprice-puppet-feature/master/port-psql-to-ruby
Conflicts:
	manifests/database.pp
	manifests/database_grant.pp
	manifests/psql.pp
	manifests/role.pp
2012-11-30 15:49:07 -08:00
Spenser Gilliland
f7a939b290 Fix Issue #38: Require postgresql-server package to run initdb exec 2012-11-27 13:58:30 -06:00
Andreas Ntaflos
d44de361b6 Set sensible path in exec to reload postgres
In the exec resource to reload postgres add path parameter and set it to
"/usr/bin:/usr/sbin:/bin:/sbin", so that the service command can be
called correctly on different platforms.
2012-11-15 16:39:56 +01:00
Andreas Ntaflos
19a512b06d Add new exec 'reload_postgresql' and have the pg_hba.conf file resource
notify that exec after changes to pg_hba.conf. This avoids restarting
the whole postgresql cluster for configuration changes in pg_hba.conf
which only need a reload.
2012-11-09 23:46:16 +01:00
Chris Price
7612cb9539 Merge pull request #32 from antaflos/quote-dbname
Properly quote database name when using postgresql::psql
2012-11-09 08:13:31 -08:00
Andreas Ntaflos
c4147a4105 Properly quote database name when using postgresql::psql for GRANT or REVOKE. 2012-11-09 04:20:36 +01:00
Etienne Pelletier
9adcd182f8 Added check before adding postgresql::user
This is to make sure there are no duplicate definitions when creating multiple
databases owned by the same user.
2012-11-08 12:50:08 -06: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
William Van Hevelingen
bdf6c0b84c Puppet lint fixes
- left longer than 80 char warnings
 - left inherits params class warnings
2012-11-03 02:37:20 +00:00
Albert Koch
9a0716f127 Support special characters in database role name
This will allow characters such as '-' in database role
names. Additionally, escaping of '"' characters now applies to all '"'
characters, not just the first in a sql command.
2012-11-01 09:45:20 -04:00
Chris Price
c3c4d32267 Merge pull request #19 from jarib/fix-path-for-cat
Fix path for `/bin/cat`
2012-10-29 10:47:03 -07:00
Chris Price
8529c1fa46 Add deprecation warning for postgres::psql
This commit adds a deprecation warning for the
Exec-based postgres::psql type, and a test
to verify that the deprecation warning is
being generated.
2012-10-27 18:41:47 -07:00
dharwood
b8389d19ad ACLs functioning, added examples in README and test, comments in config manifests 2012-10-22 12:34:24 -07:00
stormcrow
399709a483 first commit of acls 2012-10-21 23:46:54 -07:00
Jari Bakken
1fe7a87923 Fix path for /bin/cat 2012-10-21 18:52:02 +02:00
Kenn Knowles
22e71423d4 Merge pull request #17 from puppetlabs-operations/master
Add postgresql::devel for development dependencies
2012-10-18 04:19:37 -07:00
Kenn Knowles
389833f87d Merge pull request #11 from cprice-puppet/bug/master/better-title-for-persist-firewall-resource
Give the persist-firewall Exec a more explicit name
2012-10-18 04:19:15 -07:00
Adrien Thebo
5e713569ac Add postgresql::devel for development dependencies 2012-10-16 21:22:30 -07:00
Henrik
1026da2914 mis-spelt param names 2012-10-04 12:16:40 +02:00
Henrik
9af4019354 $quoted_unless had extra $ 2012-10-04 12:14:46 +02:00
Henrik
69e38d5ceb missing 'default' selector case 2012-10-04 12:13:00 +02:00
Henrik
e0c1836b2e end of line comma not valid in versions < 2.8.7 2012-10-04 12:12:12 +02:00
Matthaus Owens
82c5863431 Update status for postgres service on Debian
The postgresql init script on debian/ubuntu returns 0 no matter whether postgresql is started or stopped, so puppet has no way of knowing whether to start postgresql when the service is set to 'ensure => running'. This commit adds a param to the params class called $service_status which is set to the status piped to an egrep on debian/ubuntu, which reliably returns 0 if there are clusters running and 1 if there are none. The output before and after this patch can be seen below. If the init script is fixed at some point, the logic would need to be revisited.

Before patch postgresql remains stopped after puppet run.

$ # service postgresql stop
$ #   * Stopping PostgreSQL 9.1 database server
$ # puppet apply -e "class {'postgresql::server':}"
$ #   notice: Finished catalog run in 0.15 seconds
$ # service postgresql status
$ #   Running clusters:

After patch postgresql is started after puppet run.

$ # service postgresql stop
$ #   * Stopping PostgreSQL 9.1 database server
$ # puppet apply -e "class {'postgresql::server':}"
$ #   notice: /Stage[main]/Postgresql::Server/Service[postgresqld]/ensure: ensure changed 'stopped' to 'running'
$ #   notice: Finished catalog run in 2.26 seconds
$ # service postgresql status
$ #   Running clusters: 9.1/main
2012-09-28 15:53:33 -07:00
Chris Price
f221c8a6a4 Give the persist-firewall Exec a more explicit name
The title I'd used for the persist-firewall resource
was too generic, and fairly likely to collide with
resources in other modules.  This commit simply
renames it to be a bit more explicit about belonging
to this module, to reduce the likelihood of a title
collision.
2012-09-21 09:02:59 -07:00
Kenn Knowles
7181817e6a Merge pull request #9 from cprice-puppet/feature/master/connection-validator
Feature/master/connection validator
2012-09-16 18:34:58 -07:00
Chris Price
fd1b15b950 Add a type for validating a postgres connection
This commit adds a new resource type that can be used to validate
that a successful postgres connection can be established from a
puppet node to a (potentially remote) postgres database instance.
2012-09-14 13:26:28 -07:00