diff --git a/CHANGELOG.md b/CHANGELOG.md index cae4b9d..fd177fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ rs-base Cookbook CHANGELOG This file is used to list changes made in each version of the rs-base cookbook. +v1.1.4 +------ + +- Workaround added creating swap file on RedHat Enterprise Linux 7.0. + v1.1.3 ------ diff --git a/metadata.rb b/metadata.rb index df1f5e3..dd99975 100644 --- a/metadata.rb +++ b/metadata.rb @@ -4,7 +4,7 @@ license 'Apache 2.0' description 'Installs/Configures rs-base' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '1.1.3' +version '1.1.4' supports "centos" supports "ubuntu" diff --git a/recipes/swap.rb b/recipes/swap.rb index 744cabb..44e44f0 100644 --- a/recipes/swap.rb +++ b/recipes/swap.rb @@ -2,7 +2,7 @@ # Cookbook Name:: rs-base # Recipe:: swap # -# Copyright (C) 2013 RightScale, Inc. +# Copyright (C) 2015 RightScale, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -31,8 +31,17 @@ action :create end +# The swap cookbook expects the size to be in MB. So convert the size in GB to MB. +size_mb = node['rs-base']['swap']['size'].to_i * 1024 + +# RHEL 7.0 currently fails using an 'fallocate' file as swap which is what is done by the 'swap' community cookbook. +# Following is a workaround to create the file first with 'dd'. +# 'dd' command generated from https://github.com/sethvargo-cookbooks/swap/blob/v0.3.8/libraries/swapfile_provider.rb#L141 +if node['platform'] == 'redhat' && node['platform_version'] == '7.0' + execute "dd if=/dev/zero of=#{node['rs-base']['swap']['file']} bs=1048576 count=#{size_mb}" +end + swap_file node['rs-base']['swap']['file'] do - # The swap cookbook expects the size to be in MB. So convert the size in GB to MB. - size node['rs-base']['swap']['size'].to_i * 1024 + size size_mb action :create end