diff --git a/README.md b/README.md
index 21ca0cb..27ecd2e 100644
--- a/README.md
+++ b/README.md
@@ -210,16 +210,6 @@ Attributes
Type of database, can be sqlite, mysql or pgsql |
"mysql" |
-
- node['owncloud']['config']['dbinstance'] |
- mySQL database instance name to run by the mysql_service lwrp from the mysql cookbook |
- "default" |
-
-
- node['owncloud']['config']['dbversion'] |
- mySQL version to install by the mysql_service lwrp. Refer to https://github.com/chef-cookbooks/mysql#platform-support |
- nil |
-
node['owncloud']['config']['dbname'] |
Name of the ownCloud database |
@@ -235,11 +225,6 @@ Attributes
Password to access the ownCloud database |
calculated |
-
- node['owncloud']['config']['dbrootpassword'] |
- Database admin password to access a database instance |
- calculated |
-
node['owncloud']['config']['dbhost'] |
Host running the ownCloud database |
@@ -330,6 +315,21 @@ Attributes
Whether to skip settings the permissions of the ownCloud directory. Set this to true when using NFS synced folders. |
false |
+
+ node['owncloud']['database']['rootpassword'] |
+ Database admin password to access a database instance |
+ calculated |
+
+
+ node['owncloud']['database']['instance'] |
+ mySQL database instance name to run by the mysql_service lwrp from the mysql cookbook |
+ "default" |
+
+
+ node['owncloud']['database']['version'] |
+ mySQL version to install by the mysql_service lwrp. Refer to https://github.com/chef-cookbooks/mysql#platform-support |
+ nil |
+
Recipes
@@ -350,7 +350,7 @@ On the first run, several passwords will be automatically generated and stored i
* `node['owncloud']['admin']['pass']`
* `node['owncloud']['config']['dbpassword']` (Only when using *MySQL* or *PostgreSQL*)
-* `node['owncloud']['config']['dbrootpassword']` (Only when using *MySQL* or *PostgreSQL*)
+* `node['owncloud']['database']['rootpassword']` (Only when using *MySQL* or *PostgreSQL*)
When using Chef Solo, these passwords need to be set manually.
diff --git a/attributes/default.rb b/attributes/default.rb
index c12232d..12a09c9 100644
--- a/attributes/default.rb
+++ b/attributes/default.rb
@@ -43,12 +43,9 @@
default['owncloud']['admin']['pass'] = nil
default['owncloud']['config']['dbtype'] = 'mysql'
-default['owncloud']['config']['dbinstance'] = 'default'
-default['owncloud']['config']['dbversion'] = nil
default['owncloud']['config']['dbname'] = 'owncloud'
default['owncloud']['config']['dbuser'] = 'owncloud'
default['owncloud']['config']['dbpassword'] = nil
-default['owncloud']['config']['dbrootpassword'] = nil
default['owncloud']['config']['dbhost'] = '127.0.0.1'
default['owncloud']['config']['dbtableprefix'] = ''
@@ -68,3 +65,7 @@
default['owncloud']['cron']['hour'] = '*'
default['owncloud']['cron']['month'] = '*'
default['owncloud']['cron']['weekday'] = '*'
+
+default['owncloud']['database']['instance'] = 'default'
+default['owncloud']['database']['rootpassword'] = nil
+default['owncloud']['database']['version'] = nil
diff --git a/metadata.rb b/metadata.rb
index 3cbc256..970ddd4 100644
--- a/metadata.rb
+++ b/metadata.rb
@@ -280,20 +280,6 @@
:required => 'optional',
:default => '"mysql"'
-attribute 'owncloud/config/dbinstance',
- :display_name => 'mySQL database instance name',
- :description => 'mySQL database instance name to run by the mysql_service lwrp from the mysql cookbook',
- :type => 'string',
- :required => 'optional',
- :default => '"default"'
-
-attribute 'owncloud/config/dbversion',
- :display_name => 'mySQL server version',
- :description => 'mySQL version to install by the mysql_service lwrp. Refer to https://github.com/chef-cookbooks/mysql#platform-support',
- :type => 'string',
- :required => 'optional',
- :default => 'nil'
-
attribute 'owncloud/config/dbname',
:display_name => 'ownCloud Database Name',
:description => 'Name of the ownCloud database',
@@ -315,13 +301,6 @@
:type => 'string',
:required => 'optional'
-attribute 'owncloud/config/dbrootpassword',
- :display_name => 'Database Root Password',
- :description => 'Database admin password to access a database instance',
- :calculated => true,
- :type => 'string',
- :required => 'optional'
-
attribute 'owncloud/config/dbhost',
:display_name => 'ownCloud Database Host',
:description => 'Host running the ownCloud database',
@@ -451,3 +430,25 @@
:choice => [ 'true', 'false' ],
:type => 'string',
:required => 'optional'
+
+attribute 'owncloud/databse/rootpassword',
+ :display_name => 'Database Root Password',
+ :description => 'Database admin password to access a database instance',
+ :calculated => true,
+ :type => 'string',
+ :required => 'optional'
+
+attribute 'owncloud/database/instance',
+ :display_name => 'mySQL database instance name',
+ :description => 'mySQL database instance name to run by the mysql_service lwrp from the mysql cookbook',
+ :type => 'string',
+ :required => 'optional',
+ :default => '"default"'
+
+attribute 'owncloud/database/version',
+ :display_name => 'mySQL server version',
+ :description => 'mySQL version to install by the mysql_service lwrp. Refer to https://github.com/chef-cookbooks/mysql#platform-support',
+ :type => 'string',
+ :required => 'optional',
+ :default => 'nil'
+
diff --git a/recipes/default.rb b/recipes/default.rb
index 44c6868..f6952be 100644
--- a/recipes/default.rb
+++ b/recipes/default.rb
@@ -71,7 +71,7 @@
if node['owncloud']['config']['dbpassword'].nil? and node['owncloud']['config']['dbtype'] != 'sqlite'
Chef::Application.fatal!('You must set owncloud\'s database password in chef-solo mode.')
end
- if node['owncloud']['config']['dbrootpassword'].nil? and node['owncloud']['config']['dbtype'] != 'sqlite'
+ if node['owncloud']['database']['rootpassword'].nil? and node['owncloud']['config']['dbtype'] != 'sqlite'
Chef::Application.fatal!('You must set the database admin password in chef-solo mode.')
end
if node['owncloud']['admin']['pass'].nil?
@@ -80,7 +80,7 @@
else
unless node['owncloud']['config']['dbtype'] == 'sqlite'
node.set_unless['owncloud']['config']['dbpassword'] = secure_password
- node.set_unless['owncloud']['config']['dbrootpassword'] = secure_password
+ node.set_unless['owncloud']['database']['rootpassword'] = secure_password
end
node.set_unless['owncloud']['admin']['pass'] = secure_password
node.save
@@ -121,23 +121,23 @@
when 'mysql'
if %w{ localhost 127.0.0.1 }.include?(node['owncloud']['config']['dbhost'])
# Install MySQL
- dbinstance = node['owncloud']['config']['dbinstance']
+ dbinstance = node['owncloud']['database']['instance']
mysql2_chef_gem dbinstance do
action :install
end
mysql_service dbinstance do
- version node['owncloud']['config']['dbversion']
+ version node['owncloud']['database']['version']
bind_address '127.0.0.1'
port '3306'
- initial_root_password node['owncloud']['config']['dbrootpassword']
+ initial_root_password node['owncloud']['database']['rootpassword']
action [:create, :start]
end
mysql_connection_info = {
:host => '127.0.0.1',
:username => 'root',
- :password => node['owncloud']['config']['dbrootpassword']
+ :password => node['owncloud']['database']['rootpassword']
}
mysql_database node['owncloud']['config']['dbname'] do
@@ -160,10 +160,10 @@
if ::Chef::Config[:solo]
attr = node['postgresql'] && node['postgresql']['password'] && node['postgresql']['password']['postgres']
unless attr
- node.set['postgresql']['password']['postgres'] = node['owncloud']['config']['dbrootpassword']
+ node.set['postgresql']['password']['postgres'] = node['owncloud']['database']['rootpassword']
end
else
- node.set_unless['postgresql']['password']['postgres'] = node['owncloud']['config']['dbrootpassword']
+ node.set_unless['postgresql']['password']['postgres'] = node['owncloud']['database']['rootpassword']
end
include_recipe 'postgresql::server'
diff --git a/test/kitchen/cookbooks/owncloud_test/recipes/mysql.rb b/test/kitchen/cookbooks/owncloud_test/recipes/mysql.rb
index d76f9a5..63d7329 100644
--- a/test/kitchen/cookbooks/owncloud_test/recipes/mysql.rb
+++ b/test/kitchen/cookbooks/owncloud_test/recipes/mysql.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-node.default['owncloud']['config']['dbrootpassword'] = 'vagrant_root'
+node.default['owncloud']['database']['rootpassword'] = 'vagrant_root'
node.default['owncloud']['config']['dbpassword'] = 'database_pass'
include_recipe 'owncloud_test::common'
diff --git a/test/kitchen/cookbooks/owncloud_test/recipes/nginx.rb b/test/kitchen/cookbooks/owncloud_test/recipes/nginx.rb
index 42de9df..6ceb244 100644
--- a/test/kitchen/cookbooks/owncloud_test/recipes/nginx.rb
+++ b/test/kitchen/cookbooks/owncloud_test/recipes/nginx.rb
@@ -19,7 +19,7 @@
node.default['owncloud']['web_server'] = 'nginx'
-node.default['owncloud']['config']['dbrootpassword'] = 'vagrant_root'
+node.default['owncloud']['database']['rootpassword'] = 'vagrant_root'
node.default['owncloud']['config']['dbpassword'] = 'database_pass'
diff --git a/test/kitchen/cookbooks/owncloud_test/recipes/postgresql.rb b/test/kitchen/cookbooks/owncloud_test/recipes/postgresql.rb
index 23c5e71..82e1a36 100644
--- a/test/kitchen/cookbooks/owncloud_test/recipes/postgresql.rb
+++ b/test/kitchen/cookbooks/owncloud_test/recipes/postgresql.rb
@@ -17,7 +17,7 @@
# limitations under the License.
#
-node.default['owncloud']['config']['dbrootpassword'] = 'vagrant_postgres'
+node.default['owncloud']['database']['rootpassword'] = 'vagrant_postgres'
node.default['owncloud']['config']['dbpassword'] = 'database_pass'
node.default['owncloud']['config']['dbtype'] = 'pgsql'