Skip to content

Commit

Permalink
a33371 - added -ex flags to bash resource calls where appropriate. Cl…
Browse files Browse the repository at this point in the history
…eaned up trailing whitespaces during the process. [db] and [db_mysql] recipes taken care of by Erik.
  • Loading branch information
Lopaka Delp committed Jan 25, 2012
1 parent 080de4d commit 7792566
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions recipes/setup_swap.rb
Expand Up @@ -14,6 +14,7 @@ def clean_swap(swap_file)

# Turn off swap on swap_file if turned on
bash 'deactivate swapfile' do
flags "-ex"
only_if { File.open('/proc/swaps').grep(/^#{swap_file}\b/).any? }
code <<-eof
swapoff #{swap_file}
Expand All @@ -39,6 +40,7 @@ def create_swap(swap_file, swap_size)

# Make sure swapfile directory exists, create swapfile, set it as swap, and turn swap on
bash 'create swapfile' do
flags "-ex"
not_if { File.exists?(swap_file) }
code <<-eof
mkdir -p `dirname #{swap_file}`
Expand All @@ -48,8 +50,8 @@ def create_swap(swap_file, swap_size)
swapon #{swap_file}
eof
end
# add swap to /etc/fstab

# add swap to /etc/fstab
mount '/dev/null' do
action :enable
device "#{swap_file}"
Expand Down

0 comments on commit 7792566

Please sign in to comment.