Skip to content

Commit

Permalink
Install old ownCloud versions on some platforms:
Browse files Browse the repository at this point in the history
Improves some platform versions support:

* Debian `6`.
* CentOS `6`.
* Scientific Linux `6`.
  • Loading branch information
zuazo committed Oct 1, 2015
1 parent da0d9bb commit 336c270
Show file tree
Hide file tree
Showing 12 changed files with 80 additions and 120 deletions.
8 changes: 1 addition & 7 deletions .kitchen.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
12 changes: 11 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
5 changes: 2 additions & 3 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
17 changes: 5 additions & 12 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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|
Expand Down
4 changes: 3 additions & 1 deletion test/cookbooks/owncloud_test/attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/integration/mysql/serverspec/owncloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/integration/nginx/serverspec/owncloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/integration/postgresql/serverspec/owncloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/integration/sqlite/serverspec/owncloud_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
138 changes: 50 additions & 88 deletions test/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand All @@ -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),
Expand All @@ -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|
Expand Down

0 comments on commit 336c270

Please sign in to comment.