diff --git a/.kitchen.docker.yml b/.kitchen.docker.yml index 710b0c6..7f3e29d 100644 --- a/.kitchen.docker.yml +++ b/.kitchen.docker.yml @@ -13,8 +13,6 @@ platforms: # Operation not supported: # - name: centos-7 # run_list: recipe[selinux::disabled] -# No PHP 5.4 support: -# - name: debian-6 - name: debian-7 - name: debian-8 - name: ubuntu-12.04 @@ -38,14 +36,10 @@ suites: - ubuntu-15.04 - name: sqlite run_list: recipe[owncloud_test::sqlite] - excludes: - # Error: mysql55w-libs conflicts with mysql-libs-5.1.73-5.el6_6.x86_64: - - centos-6 - - scientific-6.6 - name: nginx run_list: recipe[owncloud_test::nginx] excludes: - # php54w-common conflicts with php-common-5.3.3-46.el6_6.x86_64: + # nginx: The page you are looking for is not found. - centos-6 # Can't connect to MySQL server on '127.0.0.1' (111): - ubuntu-12.04 diff --git a/.kitchen.yml b/.kitchen.yml index 355f144..2dbf4e5 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -29,8 +29,7 @@ platforms: # run_list: recipe[selinux::disabled] - name: centos-7.1 run_list: recipe[selinux::disabled] -# No PHP 5.4 support: -# - name: debian-6.0.10 +- name: debian-6.0.10 - name: debian-7.8 - name: debian-8.1 - name: ubuntu-12.04 @@ -43,11 +42,12 @@ suites: - name: postgresql run_list: recipe[owncloud_test::postgresql] excludes: + # Parent directory /etc/postgresql/8.4/main does not exist: + - debian-6.0.10 - debian-7.8 # Chef::Exceptions::Package: No candidate version available for postgresql-client-9.1 - debian-8.1 # https://github.com/hw-cookbooks/postgresql/issues/249 - - ubuntu-10.04 - ubuntu-12.04 - ubuntu-15.04 # libpq.so: undefined reference to `SSL_[...]@OPENSSL_1.0.0' diff --git a/README.md b/README.md index e3e2231..ae9c9db 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ Attributes | Attribute | Default | Description | |:----------------------------------------------------|:--------------|:-------------------------------| -| `node['owncloud']['version']` | `'latest'` | Version of ownCloud to install. +| `node['owncloud']['version']` | *calculated* | Version of ownCloud to install. | `node['owncloud']['download_url']` | *calculated* | URL from where ownCloud will be downloaded. | `node['owncloud']['deploy_from_git']` | `false` | Whether ownCloud should be deployed from the git repository. | `node['owncloud']['git_repo']` | *calculated* | URL of the ownCloud git repository. diff --git a/attributes/default.rb b/attributes/default.rb index 2cc4930..7817c4b 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -20,7 +20,17 @@ # limitations under the License. # -default['owncloud']['version'] = 'latest' +default['owncloud']['version'] = + # ownCloud 8 requires PHP 5.4 + if (platform_family?('rhel') && !platform?('amazon') && + node['platform_version'].to_i < 7) || + (platform?('debian') && node['platform_version'].to_i < 7) || + (platform?('ubuntu') && node['platform_version'].to_i < 12) + '7.0.4' + else + 'latest' + end + default['owncloud']['download_url'] = 'http://download.owncloud.org/community/owncloud-%{version}.tar.bz2' diff --git a/metadata.rb b/metadata.rb index 9de1787..53ece35 100644 --- a/metadata.rb +++ b/metadata.rb @@ -56,16 +56,15 @@ depends 'postfix', '~> 3.0' depends 'postgresql', '~> 3.4' depends 'ssl_certificate', '~> 1.1' -depends 'yum-webtatic', '~> 0.4.0' recipe 'owncloud::default', 'Installs and configures ownCloud' attribute 'owncloud/version', display_name: 'ownCloud Version', description: 'Version of ownCloud to install', + calculated: true, type: 'string', - required: 'optional', - default: 'latest' + required: 'optional' attribute 'owncloud/download_url', display_name: 'ownCloud Download Url', diff --git a/recipes/default.rb b/recipes/default.rb index a8a4c06..9e6bae3 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -38,11 +38,11 @@ php_pkgs << 'php5-mysql' if dbtype == 'mysql' php_pkgs << 'php5-pgsql' if dbtype == 'pgsql' when 'rhel' - if node['platform'] != 'amazon' && node['platform_version'].to_f < 7 - php_pkgs = %w(php54w-gd php54w-mbstring php54w-xml php54w-intl samba-client) - php_pkgs << 'php54w-pdo' if dbtype == 'sqlite' - php_pkgs << 'php54w-mysql' if dbtype == 'mysql' - php_pkgs << 'php54w-pgsql' if dbtype == 'pgsql' + if node['platform'] != 'amazon' && node['platform_version'].to_f < 6 + php_pkgs = %w(php53-gd php53-mbstring php53-xml php53-intl samba-client) + php_pkgs << 'php53-pdo' if dbtype == 'sqlite' + php_pkgs << 'php53-mysql' if dbtype == 'mysql' + php_pkgs << 'php53-pgsql' if dbtype == 'pgsql' else php_pkgs = %w(php-gd php-mbstring php-xml php-intl samba-client) php_pkgs << 'php-pdo' if dbtype == 'sqlite' @@ -123,13 +123,6 @@ end end -if node['platform_family'] == 'rhel' && node['platform_version'].to_i < 7 - include_recipe 'yum-webtatic' - node.default['php']['packages'] = - %w(php54w php54w-devel php54w-cli php54w-pear) - node.default['php']['mysql']['package'] = 'php54w-mysql' -end - include_recipe 'php' php_pkgs.each do |pkg| diff --git a/test/cookbooks/owncloud_test/attributes/default.rb b/test/cookbooks/owncloud_test/attributes/default.rb index 17722f0..e83b4fe 100644 --- a/test/cookbooks/owncloud_test/attributes/default.rb +++ b/test/cookbooks/owncloud_test/attributes/default.rb @@ -21,4 +21,6 @@ # # Until sendmail fixed: https://github.com/owncloud/core/issues/19110 -default['owncloud']['version'] = '8.0.8' +if node['owncloud']['version'] == 'latest' + default['owncloud']['version'] = '8.0.8' +end diff --git a/test/integration/mysql/serverspec/owncloud_spec.rb b/test/integration/mysql/serverspec/owncloud_spec.rb index fe0adf2..8e725f8 100644 --- a/test/integration/mysql/serverspec/owncloud_spec.rb +++ b/test/integration/mysql/serverspec/owncloud_spec.rb @@ -36,7 +36,7 @@ end it 'is installed' do - expect(body_json['installed']).to eq(true) + expect([true, 'true']).to include(body_json['installed']) end end # http /status.php diff --git a/test/integration/nginx/serverspec/owncloud_spec.rb b/test/integration/nginx/serverspec/owncloud_spec.rb index fe0adf2..8e725f8 100644 --- a/test/integration/nginx/serverspec/owncloud_spec.rb +++ b/test/integration/nginx/serverspec/owncloud_spec.rb @@ -36,7 +36,7 @@ end it 'is installed' do - expect(body_json['installed']).to eq(true) + expect([true, 'true']).to include(body_json['installed']) end end # http /status.php diff --git a/test/integration/postgresql/serverspec/owncloud_spec.rb b/test/integration/postgresql/serverspec/owncloud_spec.rb index fe0adf2..8e725f8 100644 --- a/test/integration/postgresql/serverspec/owncloud_spec.rb +++ b/test/integration/postgresql/serverspec/owncloud_spec.rb @@ -36,7 +36,7 @@ end it 'is installed' do - expect(body_json['installed']).to eq(true) + expect([true, 'true']).to include(body_json['installed']) end end # http /status.php diff --git a/test/integration/sqlite/serverspec/owncloud_spec.rb b/test/integration/sqlite/serverspec/owncloud_spec.rb index fe0adf2..8e725f8 100644 --- a/test/integration/sqlite/serverspec/owncloud_spec.rb +++ b/test/integration/sqlite/serverspec/owncloud_spec.rb @@ -36,7 +36,7 @@ end it 'is installed' do - expect(body_json['installed']).to eq(true) + expect([true, 'true']).to include(body_json['installed']) end end # http /status.php diff --git a/test/unit/recipes/default_spec.rb b/test/unit/recipes/default_spec.rb index d337047..8a2b73f 100644 --- a/test/unit/recipes/default_spec.rb +++ b/test/unit/recipes/default_spec.rb @@ -55,6 +55,39 @@ .and_return(false) end + versions_spec = { + 'Amazon@2012.09' => 'latest', + 'Debian@6.0.5' => /^7\./, + 'Debian@7.0' => 'latest', + 'CentOS@5.10' => /^7\./, + 'CentOS@6.0' => /^7\./, + 'CentOS@7.0' => 'latest', + 'Ubuntu@10.04' => /^7\./, + 'Ubuntu@12.04' => 'latest' + } + + context 'ownCloud installed version' do + versions_spec.each do |platform_spec, owncloud_version| + platform, platform_version = platform_spec.split('@', 2) + context "on #{platform} #{platform_version}" do + let(:chef_runner) do + ChefSpec::SoloRunner.new( + platform: platform.downcase, version: platform_version + ) + end + + it "is #{owncloud_version.inspect}" do + chef_run + if owncloud_version.is_a?(String) + expect(node['owncloud']['version']).to eq(owncloud_version) + else + expect(node['owncloud']['version']).to match(owncloud_version) + end + end + end # context on platform platform_version + end # versions_spec each + end # context ownCloud installed version + context 'on Ubuntu' do let(:chef_runner) do ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '12.04') @@ -126,17 +159,6 @@ .with_key('E5267A6C') .with_deb_src(true) end - - it 'does not include yum-webtatic recipe' do - expect(chef_run).to_not include_recipe('yum-webtatic') - end - - it 'does not change PHP 5.4 packages in attributes' do - chef_run - expect(node['php']['packages']) - .to_not eq(%w(php54w php54w-devel php54w-cli php54w-pear)) - expect(node['php']['mysql']['package']).to_not eq('php54w-mysql') - end end # context on Ubuntu 12.04 context 'on Ubuntu 14.04' do @@ -147,102 +169,40 @@ it 'does not add ondrej-php5-oldstable apt repository' do expect(chef_run).to_not add_apt_repository('ondrej-php5-oldstable') end - - it 'does not include yum-webtatic recipe' do - expect(chef_run).to_not include_recipe('yum-webtatic') - end - - it 'does not change PHP 5.4 packages in attributes' do - chef_run - expect(node['php']['packages']) - .to_not eq(%w(php54w php54w-devel php54w-cli php54w-pear)) - expect(node['php']['mysql']['package']).to_not eq('php54w-mysql') - end end # context on Ubuntu 14.04 - context 'on CentOS 5' do - let(:chef_runner) do - ChefSpec::SoloRunner.new(platform: 'centos', version: '5.10') - end - - it 'includes yum-webtatic recipe' do - expect(chef_run).to include_recipe('yum-webtatic') - end - - it 'changes PHP 5.4 packages in attributes' do - chef_run - expect(node['php']['packages']) - .to eq(%w(php54w php54w-devel php54w-cli php54w-pear)) - expect(node['php']['mysql']['package']).to eq('php54w-mysql') - end - end # context on CentOS 5 - - context 'on CentOS 6' do - let(:chef_runner) do - ChefSpec::SoloRunner.new(platform: 'centos', version: '6.0') - end - - it 'includes yum-webtatic recipe' do - expect(chef_run).to include_recipe('yum-webtatic') - end - - it 'changes PHP 5.4 packages in attributes' do - chef_run - expect(node['php']['packages']) - .to eq(%w(php54w php54w-devel php54w-cli php54w-pear)) - expect(node['php']['mysql']['package']).to eq('php54w-mysql') - end - end # context on CentOS 6 - - context 'on CentOS 7' do - let(:chef_runner) do - ChefSpec::SoloRunner.new(platform: 'centos', version: '7.0') - end - - it 'does not include yum-webtatic recipe' do - expect(chef_run).to_not include_recipe('yum-webtatic') - end - - it 'does not change PHP 5.4 packages in attributes' do - chef_run - expect(node['php']['packages']) - .to_not eq(%w(php54w php54w-devel php54w-cli php54w-pear)) - expect(node['php']['mysql']['package']).to_not eq('php54w-mysql') - end - end # context on CentOS 7 - it 'includes php recipe' do expect(chef_run).to include_recipe('php') end packages_spec = { - 'debian@7.0' => { + 'Debian@7.0' => { 'core' => %w(php5-gd php5-intl php5-curl php5-json smbclient), 'sqlite' => %w(php5-sqlite), 'mysql' => %w(php5-mysql), 'pgsql' => %w(php5-pgsql) }, - 'centos@5.10' => { + 'CentOS@5.10' => { 'core' => - %w(php54w-gd php54w-mbstring php54w-xml php54w-intl samba-client), - 'sqlite' => %w(php54w-pdo), - 'mysql' => %w(php54w-mysql), - 'pgsql' => %w(php54w-pgsql) + %w(php53-gd php53-mbstring php53-xml php53-intl samba-client), + 'sqlite' => %w(php53-pdo), + 'mysql' => %w(php53-mysql), + 'pgsql' => %w(php53-pgsql) }, - 'centos@6.0' => { + 'CentOS@6.0' => { 'core' => - %w(php54w-gd php54w-mbstring php54w-xml php54w-intl samba-client), - 'sqlite' => %w(php54w-pdo), - 'mysql' => %w(php54w-mysql), - 'pgsql' => %w(php54w-pgsql) + %w(php-gd php-mbstring php-xml php-intl samba-client), + 'sqlite' => %w(php-pdo), + 'mysql' => %w(php-mysql), + 'pgsql' => %w(php-pgsql) }, - 'centos@7.0' => { + 'CentOS@7.0' => { 'core' => %w(php-gd php-mbstring php-xml php-intl samba-client), 'sqlite' => %w(php-pdo), 'mysql' => %w(php-mysql), 'pgsql' => %w(php-pgsql) }, - 'fedora@20' => { + 'Fedora@20' => { 'core' => %w(php-gd php-mbstring php-xml php-intl samba-client), 'sqlite' => %w(php-pdo), 'mysql' => %w(php-mysql), @@ -253,9 +213,11 @@ packages_spec.each do |platform_spec, packages_by_type| platform, platform_version = platform_spec.split('@', 2) - context "on #{platform.capitalize} #{platform_version}" do + context "on #{platform} #{platform_version}" do let(:chef_runner) do - ChefSpec::SoloRunner.new(platform: platform, version: platform_version) + ChefSpec::SoloRunner.new( + platform: platform.downcase, version: platform_version + ) end packages_by_type.each do |dbtype, packages|