freighthop 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Puppetfile +1 -0
- data/Puppetfile.lock +3 -0
- data/Vagrantfile +1 -1
- data/bin/fh +2 -78
- data/lib/freighthop/cli/help.rb +69 -0
- data/lib/freighthop/cli/ssh.rb +46 -0
- data/lib/freighthop/cli/vagrant.rb +26 -0
- data/lib/freighthop/cli.rb +40 -0
- data/lib/freighthop/config.rb +4 -0
- data/lib/freighthop/vagrant_env.rb +24 -0
- data/lib/freighthop/version.rb +1 -1
- data/lib/freighthop.rb +7 -4
- data/local_modules/freighthop/manifests/database/mysql.pp +20 -0
- data/local_modules/freighthop/manifests/database/postgres.pp +6 -6
- data/local_modules/freighthop/manifests/database.pp +6 -8
- data/local_modules/freighthop/manifests/init.pp +1 -8
- data/local_modules/freighthop/manifests/params.pp +0 -3
- data/modules/apt/CHANGELOG +12 -2
- data/modules/apt/Gemfile +6 -5
- data/modules/apt/Gemfile.lock +40 -5
- data/modules/apt/Modulefile +1 -1
- data/modules/apt/README.md +2 -1
- data/modules/apt/Rakefile +1 -0
- data/modules/apt/manifests/init.pp +4 -1
- data/modules/apt/manifests/ppa.pp +1 -1
- data/modules/apt/manifests/update.pp +1 -0
- data/modules/apt/metadata.json +21 -13
- data/modules/apt/spec/defines/ppa_spec.rb +3 -3
- data/modules/apt/spec/defines/source_spec.rb +2 -2
- data/modules/apt/spec/spec_helper_system.rb +30 -0
- data/modules/apt/spec/system/apt_builddep_spec.rb +38 -0
- data/modules/apt/spec/system/apt_key_spec.rb +53 -0
- data/modules/apt/spec/system/apt_ppa_spec.rb +59 -0
- data/modules/apt/spec/system/apt_source_spec.rb +51 -0
- data/modules/apt/spec/system/basic_spec.rb +10 -0
- data/modules/apt/spec/system/class_spec.rb +20 -0
- data/modules/apt/templates/source.list.erb +2 -2
- data/modules/freighthop/manifests/database/mysql.pp +20 -0
- data/modules/freighthop/manifests/database/postgres.pp +6 -6
- data/modules/freighthop/manifests/database.pp +6 -8
- data/modules/freighthop/manifests/init.pp +1 -8
- data/modules/freighthop/manifests/params.pp +0 -3
- data/modules/mysql/CHANGELOG +403 -0
- data/modules/mysql/Gemfile +24 -0
- data/modules/mysql/Gemfile.lock +129 -0
- data/modules/mysql/LICENSE +201 -0
- data/modules/mysql/Modulefile +9 -0
- data/modules/mysql/README.md +492 -0
- data/modules/mysql/Rakefile +2 -0
- data/modules/mysql/TODO +8 -0
- data/modules/mysql/files/mysqltuner.pl +966 -0
- data/modules/mysql/lib/puppet/parser/functions/mysql_deepmerge.rb +52 -0
- data/modules/mysql/lib/puppet/parser/functions/mysql_password.rb +15 -0
- data/modules/mysql/lib/puppet/parser/functions/mysql_strip_hash.rb +21 -0
- data/modules/mysql/lib/puppet/provider/database/mysql.rb +52 -0
- data/modules/mysql/lib/puppet/provider/database_grant/mysql.rb +210 -0
- data/modules/mysql/lib/puppet/provider/database_user/mysql.rb +76 -0
- data/modules/mysql/lib/puppet/provider/mysql.rb +67 -0
- data/modules/mysql/lib/puppet/provider/mysql_database/mysql.rb +68 -0
- data/modules/mysql/lib/puppet/provider/mysql_grant/mysql.rb +115 -0
- data/modules/mysql/lib/puppet/provider/mysql_user/mysql.rb +115 -0
- data/modules/mysql/lib/puppet/type/database.rb +21 -0
- data/modules/mysql/lib/puppet/type/database_grant.rb +79 -0
- data/modules/mysql/lib/puppet/type/database_user.rb +31 -0
- data/modules/mysql/lib/puppet/type/mysql_database.rb +22 -0
- data/modules/mysql/lib/puppet/type/mysql_grant.rb +72 -0
- data/modules/mysql/lib/puppet/type/mysql_user.rb +45 -0
- data/modules/mysql/manifests/backup.pp +31 -0
- data/modules/mysql/manifests/bindings/java.pp +10 -0
- data/modules/mysql/manifests/bindings/perl.pp +10 -0
- data/modules/mysql/manifests/bindings/php.pp +10 -0
- data/modules/mysql/manifests/bindings/python.pp +10 -0
- data/modules/mysql/manifests/bindings/ruby.pp +10 -0
- data/modules/mysql/manifests/bindings.pp +33 -0
- data/modules/mysql/manifests/client/install.pp +8 -0
- data/modules/mysql/manifests/client.pp +27 -0
- data/modules/mysql/manifests/db.pp +59 -0
- data/modules/mysql/manifests/init.pp +100 -0
- data/modules/mysql/manifests/params.pp +230 -0
- data/modules/mysql/manifests/server/account_security.pp +22 -0
- data/modules/mysql/manifests/server/backup.pp +56 -0
- data/modules/mysql/manifests/server/config.pp +31 -0
- data/modules/mysql/manifests/server/install.pp +9 -0
- data/modules/mysql/manifests/server/monitor.pp +24 -0
- data/modules/mysql/manifests/server/mysqltuner.pp +9 -0
- data/modules/mysql/manifests/server/providers.pp +8 -0
- data/modules/mysql/manifests/server/root_password.pp +21 -0
- data/modules/mysql/manifests/server/service.pp +19 -0
- data/modules/mysql/manifests/server.pp +69 -0
- data/modules/mysql/metadata.json +289 -0
- data/modules/mysql/spec/classes/mysql_bindings_spec.rb +58 -0
- data/modules/mysql/spec/classes/mysql_client_spec.rb +16 -0
- data/modules/mysql/spec/classes/mysql_server_account_security_spec.rb +41 -0
- data/modules/mysql/spec/classes/mysql_server_backup_spec.rb +112 -0
- data/modules/mysql/spec/classes/mysql_server_monitor_spec.rb +31 -0
- data/modules/mysql/spec/classes/mysql_server_mysqltuner_spec.rb +5 -0
- data/modules/mysql/spec/classes/mysql_server_spec.rb +162 -0
- data/modules/mysql/spec/defines/mysql_db_spec.rb +51 -0
- data/modules/mysql/spec/spec.opts +6 -0
- data/modules/mysql/spec/spec_helper.rb +5 -0
- data/modules/mysql/spec/spec_helper_system.rb +28 -0
- data/modules/mysql/spec/system/mysql_account_delete_spec.rb +35 -0
- data/modules/mysql/spec/system/mysql_backup_spec.rb +77 -0
- data/modules/mysql/spec/system/mysql_bindings_spec.rb +90 -0
- data/modules/mysql/spec/system/mysql_db_spec.rb +61 -0
- data/modules/mysql/spec/system/mysql_server_monitor_spec.rb +30 -0
- data/modules/mysql/spec/system/mysql_server_root_password_spec.rb +71 -0
- data/modules/mysql/spec/system/mysql_server_spec.rb +85 -0
- data/modules/mysql/spec/system/types/mysql_grant_spec.rb +314 -0
- data/modules/mysql/spec/system/types/mysql_user_spec.rb +35 -0
- data/modules/mysql/spec/unit/mysql_password_spec.rb +27 -0
- data/modules/mysql/spec/unit/puppet/functions/mysql_deepmerge_spec.rb +77 -0
- data/modules/mysql/spec/unit/puppet/provider/database/mysql_spec.rb +86 -0
- data/modules/mysql/spec/unit/puppet/provider/database_grant/mysql_spec.rb +95 -0
- data/modules/mysql/spec/unit/puppet/provider/database_user/mysql_spec.rb +119 -0
- data/modules/mysql/spec/unit/puppet/provider/mysql_database/mysql_spec.rb +118 -0
- data/modules/mysql/spec/unit/puppet/provider/mysql_user/mysql_spec.rb +130 -0
- data/modules/mysql/spec/unit/puppet/type/mysql_database_spec.rb +29 -0
- data/modules/mysql/spec/unit/puppet/type/mysql_user_spec.rb +30 -0
- data/modules/mysql/templates/my.cnf.erb +17 -0
- data/modules/mysql/templates/my.cnf.pass.erb +7 -0
- data/modules/mysql/templates/my.conf.cnf.erb +17 -0
- data/modules/mysql/templates/mysqlbackup.sh.erb +57 -0
- data/modules/mysql/tests/backup.pp +8 -0
- data/modules/mysql/tests/bindings.pp +3 -0
- data/modules/mysql/tests/init.pp +1 -0
- data/modules/mysql/tests/java.pp +1 -0
- data/modules/mysql/tests/mysql_database.pp +12 -0
- data/modules/mysql/tests/mysql_grant.pp +5 -0
- data/modules/mysql/tests/mysql_user.pp +23 -0
- data/modules/mysql/tests/perl.pp +1 -0
- data/modules/mysql/tests/python.pp +1 -0
- data/modules/mysql/tests/ruby.pp +1 -0
- data/modules/mysql/tests/server/account_security.pp +4 -0
- data/modules/mysql/tests/server/config.pp +11 -0
- data/modules/mysql/tests/server.pp +3 -0
- data/modules/postgresql/Changelog +191 -0
- data/modules/postgresql/Gemfile +1 -0
- data/modules/postgresql/Gemfile.lock +9 -0
- data/modules/postgresql/LICENSE +198 -12
- data/modules/postgresql/Modulefile +2 -2
- data/modules/postgresql/NOTICE +14 -0
- data/modules/postgresql/README.md +435 -184
- data/modules/postgresql/files/validate_postgresql_connection.sh +31 -0
- data/modules/postgresql/lib/puppet/provider/postgresql_conf/parsed.rb +37 -0
- data/modules/postgresql/lib/puppet/provider/postgresql_psql/ruby.rb +4 -0
- data/modules/postgresql/lib/puppet/type/postgresql_conf.rb +31 -0
- data/modules/postgresql/lib/puppet/type/postgresql_psql.rb +4 -0
- data/modules/postgresql/manifests/client.pp +17 -16
- data/modules/postgresql/manifests/globals.pp +95 -0
- data/modules/postgresql/manifests/lib/devel.pp +15 -0
- data/modules/postgresql/manifests/lib/java.pp +15 -0
- data/modules/postgresql/manifests/lib/python.pp +13 -0
- data/modules/postgresql/manifests/params.pp +127 -222
- data/modules/postgresql/manifests/repo/apt_postgresql_org.pp +30 -0
- data/modules/postgresql/manifests/repo/yum_postgresql_org.pp +38 -0
- data/modules/postgresql/manifests/repo.pp +22 -0
- data/modules/postgresql/manifests/server/config.pp +113 -0
- data/modules/postgresql/manifests/server/config_entry.pp +43 -0
- data/modules/postgresql/manifests/server/contrib.pp +27 -0
- data/modules/postgresql/manifests/server/database.pp +75 -0
- data/modules/postgresql/manifests/server/database_grant.pp +18 -0
- data/modules/postgresql/manifests/server/db.pp +36 -0
- data/modules/postgresql/manifests/server/firewall.pp +21 -0
- data/modules/postgresql/manifests/server/grant.pp +81 -0
- data/modules/postgresql/manifests/server/initdb.pp +52 -0
- data/modules/postgresql/manifests/server/install.pp +49 -0
- data/modules/postgresql/manifests/server/passwd.pp +34 -0
- data/modules/postgresql/manifests/server/pg_hba_rule.pp +54 -0
- data/modules/postgresql/manifests/server/plperl.pp +27 -0
- data/modules/postgresql/manifests/server/reload.pp +15 -0
- data/modules/postgresql/manifests/{role.pp → server/role.pp} +19 -33
- data/modules/postgresql/manifests/server/service.pp +40 -0
- data/modules/postgresql/manifests/{table_grant.pp → server/table_grant.pp} +4 -4
- data/modules/postgresql/manifests/server/tablespace.pp +42 -0
- data/modules/postgresql/manifests/server.pp +61 -83
- data/modules/postgresql/manifests/validate_db_connection.pp +49 -50
- data/modules/postgresql/metadata.json +123 -73
- data/modules/postgresql/spec/spec_helper_system.rb +13 -1
- data/modules/postgresql/spec/system/client_spec.rb +22 -0
- data/modules/postgresql/spec/system/common_patterns_spec.rb +53 -0
- data/modules/postgresql/spec/system/contrib_spec.rb +33 -0
- data/modules/postgresql/spec/system/lib/devel_spec.rb +22 -0
- data/modules/postgresql/spec/system/lib/java_spec.rb +25 -0
- data/modules/postgresql/spec/system/lib/python_spec.rb +24 -0
- data/modules/postgresql/spec/system/postgresql_psql_spec.rb +51 -0
- data/modules/postgresql/spec/system/server/config_entry_spec.rb +32 -0
- data/modules/postgresql/spec/system/server/database_grant_spec.rb +54 -0
- data/modules/postgresql/spec/system/server/database_spec.rb +35 -0
- data/modules/postgresql/spec/system/server/db_spec.rb +143 -0
- data/modules/postgresql/spec/system/server/grant_spec.rb +55 -0
- data/modules/postgresql/spec/system/server/pg_hba_rule_spec.rb +85 -0
- data/modules/postgresql/spec/system/server/plperl_spec.rb +29 -0
- data/modules/postgresql/spec/system/server/role_spec.rb +103 -0
- data/modules/postgresql/spec/system/server/table_grant_spec.rb +72 -0
- data/modules/postgresql/spec/system/server/tablespace_spec.rb +74 -0
- data/modules/postgresql/spec/system/server_spec.rb +217 -0
- data/modules/postgresql/spec/system/validate_db_connection_spec.rb +91 -0
- data/modules/postgresql/spec/unit/classes/client_spec.rb +27 -2
- data/modules/postgresql/spec/unit/classes/globals_spec.rb +28 -0
- data/modules/postgresql/spec/unit/classes/lib/devel_spec.rb +12 -0
- data/modules/postgresql/spec/unit/classes/{postgresql_java_spec.rb → lib/java_spec.rb} +9 -19
- data/modules/postgresql/spec/unit/classes/lib/python_spec.rb +31 -0
- data/modules/postgresql/spec/unit/classes/params_spec.rb +2 -1
- data/modules/postgresql/spec/unit/classes/repo_spec.rb +17 -0
- data/modules/postgresql/spec/unit/classes/server/contrib_spec.rb +42 -0
- data/modules/postgresql/spec/unit/classes/server/initdb_spec.rb +28 -0
- data/modules/postgresql/spec/unit/classes/server/plperl_spec.rb +45 -0
- data/modules/postgresql/spec/unit/classes/server_spec.rb +83 -2
- data/modules/postgresql/spec/unit/defines/server/config_entry_spec.rb +23 -0
- data/modules/postgresql/spec/unit/defines/server/database_grant_spec.rb +26 -0
- data/modules/postgresql/spec/unit/defines/server/database_spec.rb +16 -0
- data/modules/postgresql/spec/unit/defines/server/db_spec.rb +28 -0
- data/modules/postgresql/spec/unit/defines/{database_grant_spec.rb → server/grant_spec.rb} +7 -4
- data/modules/postgresql/spec/unit/defines/{pg_hba_rule_spec.rb → server/pg_hba_rule_spec.rb} +59 -2
- data/modules/postgresql/spec/unit/defines/server/role_spec.rb +23 -0
- data/modules/postgresql/spec/unit/defines/server/table_grant_spec.rb +27 -0
- data/modules/postgresql/spec/unit/defines/server/tablespace_spec.rb +23 -0
- data/modules/postgresql/spec/unit/defines/validate_db_connection_spec.rb +22 -9
- data/modules/postgresql/spec/unit/provider/postgresql_conf/parsed_spec.rb +112 -0
- data/modules/postgresql/spec/unit/puppet/provider/postgresql_psql/ruby_spec.rb +29 -0
- data/modules/postgresql/spec/unit/puppet/type/postgresql_psql_spec.rb +1 -0
- data/modules/postgresql/spec/unit/type/postgresql_conf_spec.rb +50 -0
- metadata +177 -53
- data/modules/postgresql/examples/init.pp +0 -1
- data/modules/postgresql/examples/official-postgresql-repos.pp +0 -19
- data/modules/postgresql/examples/postgresql_database.pp +0 -22
- data/modules/postgresql/examples/postgresql_db.pp +0 -30
- data/modules/postgresql/examples/postgresql_grant.pp +0 -14
- data/modules/postgresql/examples/postgresql_pg_hba_rule.pp +0 -18
- data/modules/postgresql/examples/postgresql_pgconf_extras.pp +0 -19
- data/modules/postgresql/examples/postgresql_tablespace.pp +0 -73
- data/modules/postgresql/examples/postgresql_user.pp +0 -28
- data/modules/postgresql/examples/server.pp +0 -10
- data/modules/postgresql/lib/facter/postgres_default_version.rb +0 -69
- data/modules/postgresql/manifests/config/afterservice.pp +0 -47
- data/modules/postgresql/manifests/config/beforeservice.pp +0 -171
- data/modules/postgresql/manifests/config.pp +0 -74
- data/modules/postgresql/manifests/contrib.pp +0 -29
- data/modules/postgresql/manifests/database.pp +0 -85
- data/modules/postgresql/manifests/database_grant.pp +0 -35
- data/modules/postgresql/manifests/database_user.pp +0 -60
- data/modules/postgresql/manifests/db.pp +0 -77
- data/modules/postgresql/manifests/devel.pp +0 -27
- data/modules/postgresql/manifests/grant.pp +0 -77
- data/modules/postgresql/manifests/init.pp +0 -145
- data/modules/postgresql/manifests/initdb.pp +0 -52
- data/modules/postgresql/manifests/java.pp +0 -29
- data/modules/postgresql/manifests/package_source/apt_postgresql_org.pp +0 -21
- data/modules/postgresql/manifests/package_source/yum_postgresql_org.pp +0 -30
- data/modules/postgresql/manifests/pg_hba.pp +0 -19
- data/modules/postgresql/manifests/pg_hba_rule.pp +0 -41
- data/modules/postgresql/manifests/plperl.pp +0 -24
- data/modules/postgresql/manifests/psql.pp +0 -56
- data/modules/postgresql/manifests/python.pp +0 -18
- data/modules/postgresql/manifests/tablespace.pp +0 -59
- data/modules/postgresql/spec/system/install_spec.rb +0 -707
- data/modules/postgresql/spec/system/non_defaults_spec.rb +0 -114
- data/modules/postgresql/spec/unit/classes/contrib_spec.rb +0 -11
- data/modules/postgresql/spec/unit/classes/devel_spec.rb +0 -11
- data/modules/postgresql/spec/unit/classes/init_spec.rb +0 -71
- data/modules/postgresql/spec/unit/classes/postgresql_python_spec.rb +0 -53
- data/modules/postgresql/spec/unit/defines/database_spec.rb +0 -14
- data/modules/postgresql/spec/unit/defines/database_user_spec.rb +0 -19
- data/modules/postgresql/spec/unit/defines/db_spec.rb +0 -20
- data/modules/postgresql/spec/unit/defines/pg_hba_spec.rb +0 -20
- data/modules/postgresql/spec/unit/defines/psql_spec.rb +0 -20
- data/modules/postgresql/spec/unit/defines/role_spec.rb +0 -14
- data/modules/postgresql/spec/unit/defines/tablespace_spec.rb +0 -19
- data/modules/postgresql/spec/unit/facts/postgres_default_version_spec.rb +0 -14
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::contrib:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran, remove both contrib and server as contrib
|
6
|
+
# pulls in the server based packages.
|
7
|
+
pp = <<-EOS.unindent
|
8
|
+
class { 'postgresql::server':
|
9
|
+
ensure => absent,
|
10
|
+
}
|
11
|
+
class { 'postgresql::server::contrib':
|
12
|
+
package_ensure => purged,
|
13
|
+
}
|
14
|
+
EOS
|
15
|
+
|
16
|
+
puppet_apply(pp) do |r|
|
17
|
+
r.exit_code.should_not == 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'test loading class with no parameters' do
|
22
|
+
pp = <<-EOS.unindent
|
23
|
+
class { 'postgresql::server': }
|
24
|
+
class { 'postgresql::server::contrib': }
|
25
|
+
EOS
|
26
|
+
|
27
|
+
puppet_apply(pp) do |r|
|
28
|
+
r.exit_code.should == 2
|
29
|
+
r.refresh
|
30
|
+
r.exit_code.should == 0
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::lib::devel:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::lib::devel': package_ensure => purged }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'test loading class with no parameters' do
|
12
|
+
pp = <<-EOS.unindent
|
13
|
+
class { 'postgresql::lib::devel': }
|
14
|
+
EOS
|
15
|
+
|
16
|
+
puppet_apply(pp) do |r|
|
17
|
+
r.exit_code.should_not == 1
|
18
|
+
r.refresh
|
19
|
+
r.exit_code.should == 0
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::lib::java:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::lib::java': package_ensure => purged }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'test loading class with no parameters' do
|
12
|
+
pending('libpostgresql-java-jdbc not available natively for Ubuntu 10.04 and Debian 6',
|
13
|
+
:if => (node.facts['osfamily'] == 'Debian' and ['6', '10'].include?(node.facts['lsbmajdistrelease'])))
|
14
|
+
|
15
|
+
pp = <<-EOS.unindent
|
16
|
+
class { 'postgresql::lib::java': }
|
17
|
+
EOS
|
18
|
+
|
19
|
+
puppet_apply(pp) do |r|
|
20
|
+
r.exit_code.should_not == 1
|
21
|
+
r.refresh
|
22
|
+
r.exit_code.should == 0
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::lib::python:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::lib::python': package_ensure => purged }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'test loading class with no parameters' do
|
12
|
+
pending('psycopg2 not available natively for centos 5', :if => (node.facts['osfamily'] == 'RedHat' and node.facts['lsbmajdistrelease'] == '5'))
|
13
|
+
|
14
|
+
pp = <<-EOS.unindent
|
15
|
+
class { 'postgresql::lib::python': }
|
16
|
+
EOS
|
17
|
+
|
18
|
+
puppet_apply(pp) do |r|
|
19
|
+
r.exit_code.should_not == 1
|
20
|
+
r.refresh
|
21
|
+
r.exit_code.should == 0
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql_psql:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should run some SQL when the unless query returns no rows' do
|
12
|
+
pp = <<-EOS.unindent
|
13
|
+
class { 'postgresql::server': }
|
14
|
+
|
15
|
+
postgresql_psql { 'foobar':
|
16
|
+
db => 'postgres',
|
17
|
+
psql_user => 'postgres',
|
18
|
+
command => 'select 1',
|
19
|
+
unless => 'select 1 where 1=2',
|
20
|
+
require => Class['postgresql::server'],
|
21
|
+
}
|
22
|
+
EOS
|
23
|
+
|
24
|
+
puppet_apply(pp) do |r|
|
25
|
+
r.exit_code.should_not == 1
|
26
|
+
r.refresh
|
27
|
+
r.exit_code.should == 2
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should not run SQL when the unless query returns rows' do
|
32
|
+
pp = <<-EOS.unindent
|
33
|
+
class { 'postgresql::server': }
|
34
|
+
|
35
|
+
postgresql_psql { 'foobar':
|
36
|
+
db => 'postgres',
|
37
|
+
psql_user => 'postgres',
|
38
|
+
command => 'select * from pg_database limit 1',
|
39
|
+
unless => 'select 1 where 1=1',
|
40
|
+
require => Class['postgresql::server'],
|
41
|
+
}
|
42
|
+
EOS
|
43
|
+
|
44
|
+
puppet_apply(pp) do |r|
|
45
|
+
r.exit_code.should_not == 1
|
46
|
+
r.refresh
|
47
|
+
r.exit_code.should == 0
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::config_entry:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should change setting and reflect it in show all' do
|
12
|
+
pp = <<-EOS.unindent
|
13
|
+
class { 'postgresql::server': }
|
14
|
+
|
15
|
+
postgresql::server::config_entry { 'check_function_bodies':
|
16
|
+
value => 'off',
|
17
|
+
}
|
18
|
+
EOS
|
19
|
+
|
20
|
+
puppet_apply(pp) do |r|
|
21
|
+
r.exit_code.should_not == 1
|
22
|
+
r.refresh
|
23
|
+
r.exit_code.should == 0
|
24
|
+
end
|
25
|
+
|
26
|
+
psql('--command="show all" postgres') do |r|
|
27
|
+
r.stdout.should =~ /check_function_bodies.+off/
|
28
|
+
r.stderr.should be_empty
|
29
|
+
r.exit_code.should == 0
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::database_grant:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should grant access so a user can create objects in a database' do
|
12
|
+
begin
|
13
|
+
pp = <<-EOS.unindent
|
14
|
+
$db = 'postgres'
|
15
|
+
$user = 'psql_grant_tester'
|
16
|
+
$password = 'psql_grant_pw'
|
17
|
+
|
18
|
+
class { 'postgresql::server': }
|
19
|
+
|
20
|
+
# Since we are not testing pg_hba or any of that, make a local user for ident auth
|
21
|
+
user { $user:
|
22
|
+
ensure => present,
|
23
|
+
}
|
24
|
+
|
25
|
+
postgresql::server::role { $user:
|
26
|
+
password_hash => postgresql_password($user, $password),
|
27
|
+
}
|
28
|
+
|
29
|
+
postgresql::server::database { $db: }
|
30
|
+
|
31
|
+
postgresql::server::database_grant { 'grant create test':
|
32
|
+
privilege => 'CREATE',
|
33
|
+
db => $db,
|
34
|
+
role => $user,
|
35
|
+
}
|
36
|
+
EOS
|
37
|
+
|
38
|
+
puppet_apply(pp) do |r|
|
39
|
+
r.exit_code.should_not == 1
|
40
|
+
r.refresh
|
41
|
+
r.exit_code.should == 0
|
42
|
+
end
|
43
|
+
|
44
|
+
# Check that the user can create a table in the database
|
45
|
+
psql('--command="create table foo (foo int)" postgres', 'psql_grant_tester') do |r|
|
46
|
+
r.stdout.should =~ /CREATE TABLE/
|
47
|
+
r.stderr.should == ''
|
48
|
+
r.exit_code.should == 0
|
49
|
+
end
|
50
|
+
ensure
|
51
|
+
psql('--command="drop table foo" postgres', 'psql_grant_tester')
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::database:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should idempotently create a db that we can connect to' do
|
12
|
+
begin
|
13
|
+
pp = <<-EOS.unindent
|
14
|
+
$db = 'postgresql_test_db'
|
15
|
+
class { 'postgresql::server': }
|
16
|
+
|
17
|
+
postgresql::server::database { $db: }
|
18
|
+
EOS
|
19
|
+
|
20
|
+
puppet_apply(pp) do |r|
|
21
|
+
r.exit_code.should_not == 1
|
22
|
+
r.refresh
|
23
|
+
r.exit_code.should == 0
|
24
|
+
end
|
25
|
+
|
26
|
+
psql('--command="select datname from pg_database" postgresql_test_db') do |r|
|
27
|
+
r.stdout.should =~ /postgresql_test_db/
|
28
|
+
r.stderr.should be_empty
|
29
|
+
r.exit_code.should == 0
|
30
|
+
end
|
31
|
+
ensure
|
32
|
+
psql('--command="drop database postgresql_test_db" postgres')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::db' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should idempotently create a db that we can connect to' do
|
12
|
+
begin
|
13
|
+
pp = <<-EOS.unindent
|
14
|
+
$db = 'postgresql_test_db'
|
15
|
+
class { 'postgresql::server': }
|
16
|
+
|
17
|
+
postgresql::server::db { $db:
|
18
|
+
user => $db,
|
19
|
+
password => postgresql_password($db, $db),
|
20
|
+
}
|
21
|
+
EOS
|
22
|
+
|
23
|
+
puppet_apply(pp) do |r|
|
24
|
+
r.exit_code.should_not == 1
|
25
|
+
r.refresh
|
26
|
+
r.exit_code.should == 0
|
27
|
+
end
|
28
|
+
|
29
|
+
psql('--command="select datname from pg_database" postgresql_test_db') do |r|
|
30
|
+
r.stdout.should =~ /postgresql_test_db/
|
31
|
+
r.stderr.should be_empty
|
32
|
+
r.exit_code.should == 0
|
33
|
+
end
|
34
|
+
ensure
|
35
|
+
psql('--command="drop database postgresql_test_db" postgres')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should take a locale parameter' do
|
40
|
+
pending('no support for locale parameter with centos 5', :if => (node.facts['osfamily'] == 'RedHat' and node.facts['lsbmajdistrelease'] == '5'))
|
41
|
+
begin
|
42
|
+
pp = <<-EOS.unindent
|
43
|
+
class { 'postgresql::server': }
|
44
|
+
if($::operatingsystem == 'Debian') {
|
45
|
+
# Need to make sure the correct locale is installed first
|
46
|
+
file { '/etc/locale.gen':
|
47
|
+
content => "en_US ISO-8859-1\nen_NG UTF-8\n",
|
48
|
+
}~>
|
49
|
+
exec { '/usr/sbin/locale-gen':
|
50
|
+
logoutput => true,
|
51
|
+
refreshonly => true,
|
52
|
+
}
|
53
|
+
}
|
54
|
+
postgresql::server::db { 'test1':
|
55
|
+
user => 'test1',
|
56
|
+
password => postgresql_password('test1', 'test1'),
|
57
|
+
encoding => 'UTF8',
|
58
|
+
locale => 'en_NG',
|
59
|
+
}
|
60
|
+
EOS
|
61
|
+
|
62
|
+
puppet_apply(pp) do |r|
|
63
|
+
r.exit_code.should_not == 1
|
64
|
+
r.refresh
|
65
|
+
r.exit_code.should == 0
|
66
|
+
end
|
67
|
+
|
68
|
+
psql('-c "show lc_ctype" test1') do |r|
|
69
|
+
r.stdout.should =~ /en_NG/
|
70
|
+
end
|
71
|
+
|
72
|
+
psql('-c "show lc_collate" test1') do |r|
|
73
|
+
r.stdout.should =~ /en_NG/
|
74
|
+
end
|
75
|
+
ensure
|
76
|
+
psql('--command="drop database test1" postgres')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'should take an istemplate parameter' do
|
81
|
+
begin
|
82
|
+
pp = <<-EOS.unindent
|
83
|
+
$db = 'template2'
|
84
|
+
class { 'postgresql::server': }
|
85
|
+
|
86
|
+
postgresql::server::db { $db:
|
87
|
+
user => $db,
|
88
|
+
password => postgresql_password($db, $db),
|
89
|
+
istemplate => true,
|
90
|
+
}
|
91
|
+
EOS
|
92
|
+
|
93
|
+
puppet_apply(pp) do |r|
|
94
|
+
r.exit_code.should_not == 1
|
95
|
+
r.refresh
|
96
|
+
r.exit_code.should == 0
|
97
|
+
end
|
98
|
+
|
99
|
+
psql('--command="select datname from pg_database" template2') do |r|
|
100
|
+
r.stdout.should =~ /template2/
|
101
|
+
r.stderr.should be_empty
|
102
|
+
r.exit_code.should == 0
|
103
|
+
end
|
104
|
+
ensure
|
105
|
+
psql('--command="drop database template2" postgres') do |r|
|
106
|
+
r.stdout.should be_empty
|
107
|
+
r.stderr.should =~ /cannot drop a template database/
|
108
|
+
r.exit_code.should_not == 0
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'should update istemplate parameter' do
|
114
|
+
begin
|
115
|
+
pp = <<-EOS.unindent
|
116
|
+
$db = 'template2'
|
117
|
+
class { 'postgresql::server': }
|
118
|
+
|
119
|
+
postgresql::server::db { $db:
|
120
|
+
user => $db,
|
121
|
+
password => postgresql_password($db, $db),
|
122
|
+
istemplate => false,
|
123
|
+
}
|
124
|
+
EOS
|
125
|
+
|
126
|
+
puppet_apply(pp) do |r|
|
127
|
+
r.exit_code.should_not == 1
|
128
|
+
r.refresh
|
129
|
+
r.exit_code.should == 0
|
130
|
+
end
|
131
|
+
|
132
|
+
psql('--command="select datname from pg_database" template2') do |r|
|
133
|
+
r.stdout.should =~ /template2/
|
134
|
+
r.stderr.should be_empty
|
135
|
+
r.exit_code.should == 0
|
136
|
+
end
|
137
|
+
ensure
|
138
|
+
psql('--command="drop database template2" postgres') do |r|
|
139
|
+
r.exit_code.should == 0
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::grant:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should grant access so a user can create in a database' do
|
12
|
+
begin
|
13
|
+
pp = <<-EOS.unindent
|
14
|
+
$db = 'postgres'
|
15
|
+
$user = 'psql_grant_tester'
|
16
|
+
$password = 'psql_grant_pw'
|
17
|
+
|
18
|
+
class { 'postgresql::server': }
|
19
|
+
|
20
|
+
# Since we are not testing pg_hba or any of that, make a local user for ident auth
|
21
|
+
user { $user:
|
22
|
+
ensure => present,
|
23
|
+
}
|
24
|
+
|
25
|
+
postgresql::server::role { $user:
|
26
|
+
password_hash => postgresql_password($user, $password),
|
27
|
+
}
|
28
|
+
|
29
|
+
postgresql::server::database { $db: }
|
30
|
+
|
31
|
+
postgresql::server::grant { 'grant create test':
|
32
|
+
object_type => 'database',
|
33
|
+
privilege => 'CREATE',
|
34
|
+
db => $db,
|
35
|
+
role => $user,
|
36
|
+
}
|
37
|
+
EOS
|
38
|
+
|
39
|
+
puppet_apply(pp) do |r|
|
40
|
+
r.exit_code.should_not == 1
|
41
|
+
r.refresh
|
42
|
+
r.exit_code.should == 0
|
43
|
+
end
|
44
|
+
|
45
|
+
# Check that the user can create a table in the database
|
46
|
+
psql('--command="create table foo (foo int)" postgres', 'psql_grant_tester') do |r|
|
47
|
+
r.stdout.should =~ /CREATE TABLE/
|
48
|
+
r.stderr.should == ''
|
49
|
+
r.exit_code.should == 0
|
50
|
+
end
|
51
|
+
ensure
|
52
|
+
psql('--command="drop table foo" postgres', 'psql_grant_tester')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'postgresql::server::pg_hba_rule:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
puppet_apply("class { 'postgresql::server': ensure => absent }") do |r|
|
7
|
+
r.exit_code.should_not == 1
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should create a ruleset in pg_hba.conf' do
|
12
|
+
pp = <<-EOS.unindent
|
13
|
+
class { 'postgresql::server': }
|
14
|
+
postgresql::server::pg_hba_rule { "allow application network to access app database":
|
15
|
+
type => "host",
|
16
|
+
database => "app",
|
17
|
+
user => "app",
|
18
|
+
address => "200.1.2.0/24",
|
19
|
+
auth_method => md5,
|
20
|
+
}
|
21
|
+
EOS
|
22
|
+
|
23
|
+
puppet_apply(pp) do |r|
|
24
|
+
r.exit_code.should_not == 1
|
25
|
+
end
|
26
|
+
|
27
|
+
puppet_apply(pp) do |r|
|
28
|
+
r.exit_code.should be_zero
|
29
|
+
end
|
30
|
+
|
31
|
+
shell("grep '200.1.2.0/24' /etc/postgresql/*/*/pg_hba.conf || grep '200.1.2.0/24' /var/lib/pgsql/data/pg_hba.conf") do |r|
|
32
|
+
r.exit_code.should be_zero
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should create a ruleset in pg_hba.conf that denies db access to db test1' do
|
37
|
+
pp = <<-EOS.unindent
|
38
|
+
class { 'postgresql::server': }
|
39
|
+
|
40
|
+
postgresql::server::db { "test1":
|
41
|
+
user => "test1",
|
42
|
+
password => postgresql_password('test1', 'test1'),
|
43
|
+
grant => "all",
|
44
|
+
}
|
45
|
+
|
46
|
+
postgresql::server::pg_hba_rule { "allow anyone to have access to db test1":
|
47
|
+
type => "local",
|
48
|
+
database => "test1",
|
49
|
+
user => "test1",
|
50
|
+
auth_method => reject,
|
51
|
+
order => '001',
|
52
|
+
}
|
53
|
+
|
54
|
+
user { "test1":
|
55
|
+
shell => "/bin/bash",
|
56
|
+
managehome => true,
|
57
|
+
}
|
58
|
+
EOS
|
59
|
+
puppet_apply(pp) do |r|
|
60
|
+
r.exit_code.should_not == 1
|
61
|
+
end
|
62
|
+
|
63
|
+
shell('su - test1 -c \'psql -U test1 -c "\q" test1\'') do |r|
|
64
|
+
r.exit_code.should == 2
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'should fail catalogue if postgresql::server::manage_pga_conf is disabled' do
|
69
|
+
pp = <<-EOS.unindent
|
70
|
+
class { 'postgresql::server':
|
71
|
+
manage_pg_hba_conf => false,
|
72
|
+
}
|
73
|
+
postgresql::server::pg_hba_rule { 'foo':
|
74
|
+
type => "local",
|
75
|
+
database => "test1",
|
76
|
+
user => "test1",
|
77
|
+
auth_method => reject,
|
78
|
+
order => '001',
|
79
|
+
}
|
80
|
+
EOS
|
81
|
+
puppet_apply(pp) do |r|
|
82
|
+
r.exit_code.should == 1
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper_system'
|
2
|
+
|
3
|
+
describe 'server plperl:' do
|
4
|
+
after :all do
|
5
|
+
# Cleanup after tests have ran
|
6
|
+
pp = <<-EOS.unindent
|
7
|
+
class { 'postgresql::server': ensure => absent }
|
8
|
+
class { 'postgresql::server::plperl': package_ensure => purged }
|
9
|
+
EOS
|
10
|
+
puppet_apply(pp) do |r|
|
11
|
+
r.exit_code.should_not == 1
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'test loading class with no parameters' do
|
16
|
+
pending('no support for plperl with default version on centos 5',
|
17
|
+
:if => (node.facts['osfamily'] == 'RedHat' and node.facts['lsbmajdistrelease'] == '5'))
|
18
|
+
pp = <<-EOS.unindent
|
19
|
+
class { 'postgresql::server': }
|
20
|
+
class { 'postgresql::server::plperl': }
|
21
|
+
EOS
|
22
|
+
|
23
|
+
puppet_apply(pp) do |r|
|
24
|
+
r.exit_code.should_not == 1
|
25
|
+
r.refresh
|
26
|
+
r.exit_code.should == 0
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|