Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only include database recipe if databases are defined #6

Closed
wants to merge 1 commit into from
Closed

Only include database recipe if databases are defined #6

wants to merge 1 commit into from

Conversation

luislavena
Copy link

Check on a empty array condition always return truthy results.

Evaluate if list of databases are empty instead.

This fixes #2

Check on a empty array condition always return truthy results.

Evaluate if list of databases are empty instead.
@bsodmike
Copy link

bsodmike commented Oct 5, 2013

+1 I'm having the same problem. I've essentially got a wrapper cookbook that does

# NOTE pass to 'databox'
node.set[:databox][:db_root_password] = node[:storagebox][:db_root_password] if node[:storagebox][:db_root_password]
if node[:storagebox][:database][:mysql] && !node[:storagebox][:database][:mysql].empty?
  node.set[:databox][:database][:mysql] = node[:storagebox][:database][:mysql]
end
if node[:storagebox][:database][:postgresql] && !node[:storagebox][:database][:postgresql].empty?
  node.set[:databox][:database][:postgresql] = node[:storagebox][:database][:postgresql]
end

include_recipe "databox"

Yet, I'm seeing mysql being installed.

2013-10-05T09:26:10+00:00] INFO: template[/var/cache/local/preseeding/mysql-server.seed] updated content
[2013-10-05T09:26:10+00:00] INFO: template[/var/cache/local/preseeding/mysql-server.seed] owner changed to 0
[2013-10-05T09:26:10+00:00] INFO: template[/var/cache/local/preseeding/mysql-server.seed] group changed to 0
[2013-10-05T09:26:10+00:00] INFO: template[/var/cache/local/preseeding/mysql-server.seed] mode changed to 600
[2013-10-05T09:26:10+00:00] INFO: template[/var/cache/local/preseeding/mysql-server.seed] sending run action to execute[preseed mysql-server] (immediate)
[2013-10-05T09:26:10+00:00] INFO: execute[preseed mysql-server] ran successfully
[2013-10-05T09:26:10+00:00] INFO: template[/etc/mysql/debian.cnf] updated content
[2013-10-05T09:26:10+00:00] INFO: template[/etc/mysql/debian.cnf] owner changed to 0
[2013-10-05T09:26:10+00:00] INFO: template[/etc/mysql/debian.cnf] group changed to 0
[2013-10-05T09:26:10+00:00] INFO: template[/etc/mysql/debian.cnf] mode changed to 600
[2013-10-05T09:26:59+00:00] INFO: package[mysql-server] sending start action to service[mysql] (immediate)
[2013-10-05T09:26:59+00:00] INFO: directory[/var/run/mysqld] group changed to 111
[2013-10-05T09:26:59+00:00] INFO: directory[/var/log/mysql] group changed to 111
[2013-10-05T09:26:59+00:00] INFO: directory[/etc/mysql] owner changed to 106
[2013-10-05T09:26:59+00:00] INFO: directory[/etc/mysql] group changed to 111
[2013-10-05T09:26:59+00:00] INFO: directory[/etc/mysql/conf.d] owner changed to 106
[2013-10-05T09:26:59+00:00] INFO: directory[/etc/mysql/conf.d] group changed to 111
[2013-10-05T09:26:59+00:00] INFO: template[/etc/mysql/grants.sql] updated content
[2013-10-05T09:26:59+00:00] INFO: template[/etc/mysql/grants.sql] owner changed to 0
[2013-10-05T09:26:59+00:00] INFO: template[/etc/mysql/grants.sql] group changed to 0
[2013-10-05T09:26:59+00:00] INFO: template[/etc/mysql/grants.sql] mode changed to 600
[2013-10-05T09:26:59+00:00] INFO: template[/etc/mysql/grants.sql] sending run action to execute[mysql-install-privileges] (immediate)
[2013-10-05T09:27:00+00:00] INFO: execute[mysql-install-privileges] ran successfully
[2013-10-05T09:27:00+00:00] INFO: template[/etc/mysql/my.cnf] backed up to /var/chef/backup/etc/mysql/my.cnf.chef-20131005092700
[2013-10-05T09:27:00+00:00] INFO: template[/etc/mysql/my.cnf] updated content
[2013-10-05T09:27:00+00:00] INFO: template[/etc/mysql/my.cnf] owner changed to 0
[2013-10-05T09:27:00+00:00] INFO: template[/etc/mysql/my.cnf] group changed to 0
[2013-10-05T09:27:00+00:00] INFO: template[/etc/mysql/my.cnf] mode changed to 644
[2013-10-05T09:27:00+00:00] INFO: template[/etc/mysql/my.cnf] sending restart action to service[mysql] (immediate)
[2013-10-05T09:27:03+00:00] INFO: service[mysql] restarted
[2013-10-05T09:27:33+00:00] INFO: template[/etc/postgresql/9.1/main/postgresql.conf] backed up to /var/chef/backup/etc/postgresql/9.1/main/postgresql.conf.chef-20131005092733
[2013-10-05T09:27:33+00:00] INFO: template[/etc/postgresql/9.1/main/postgresql.conf] updated content
[2013-10-05T09:27:33+00:00] INFO: template[/etc/postgresql/9.1/main/postgresql.conf] owner changed to 107
[2013-10-05T09:27:33+00:00] INFO: template[/etc/postgresql/9.1/main/postgresql.conf] group changed to 113
[2013-10-05T09:27:33+00:00] INFO: template[/etc/postgresql/9.1/main/postgresql.conf] mode changed to 600
[2013-10-05T09:27:33+00:00] INFO: template[/etc/postgresql/9.1/main/postgresql.conf] sending reload action to service[postgresql] (immediate)
[2013-10-05T09:27:33+00:00] INFO: service[postgresql] reloaded

@teohm please merge this ASAP! Thanks.

HOLY BATMAN - this is over 5-months old; I'll patch my fork for now. Thanks.

kohenkatz added a commit to kohenkatz/databox-cookbook that referenced this pull request Jul 7, 2015
@kohenkatz
Copy link

Fixed in my fork, and released as version 0.1.2.

@luislavena luislavena closed this Jan 9, 2018
@luislavena luislavena deleted the check-empty-db-list branch January 9, 2018 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installs postgresql even though empty
3 participants