cookbook 'swap', '= 0.3.7'
The swap cookbook has been deprecated
Author provided reason for deprecation:
The swap cookbook has been deprecated and is no longer being maintained by its authors. Use of the swap cookbook is no longer recommended.
swap
(20) Versions
0.3.7
-
Follow20
Manage swap and swapfiles with Chef
cookbook 'swap', '= 0.3.7', :supermarket
knife supermarket install swap
knife supermarket download swap
Swap LWRP
This cookbook provides an LWRP for easily creating and managing swap files.
This cookbook requires Ruby 1.9 or higher!
Usage
Add a new swap:
ruby
swap_file '/mnt/swap' do
size 1024 # MBs
end
Or remove an existing one:
ruby
swap_file '/mnt/swap' do
action :remove
end
LWRP Attributes
<table>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Example</th>
<th>Default</th>
</tr>
<tr>
<td>path</td>
<td>The path to put the swap file on the system</td>
<td>/mnt/swap</td>
<td></td>
</tr>
<tr>
<td>size</td>
<td>The size (in MBs) for the swap file</td>
<td>2048</td>
<td></td>
</tr>
<tr>
<td>persist</td>
<td>Persist the swapon</td>
<td>true</td>
<td>false</td>
</tr>
</table>
Installation
If you're using berkshelf, add swap
to your Berksfile
:
cookbook 'swap'
Otherwise, install the cookbook from the community site:
knife cookbook site install swap
Have any other cookbooks depend on this cookbook by adding it to the metadata.rb
:
depends 'swap'
Now you can use the LWRP in your cookbook!
ChefSpec matchers
create_swap_file(path)
Assert that the Chef run creates swap_file.
expect(chef_run).to create_swap_file(path).with( :size => 1024 )
remove_swap_file(path)
Assert that the Chef run removes swap_file.
expect(chef_run).to remove_swap_file(path)
Contributing
- Fork the project
- Create a feature branch corresponding to you change
- Commit and test thoroughly
- Create a Pull Request on github
- ensure you add a detailed description of your changes
License and Authors
- Author:: Seth Vargo (sethvargo@gmail.com)
Copyright 2012-2013, Seth Vargo Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
swap Cookbook CHANGELOG
This file is used to list changes made in each version of the swap cookbook.
v0.3.7
- Updated to latest test harness
v0.3.6
- Remove
size
as a required attribute, since it doesn't make sense to require it during the "remove" action
v0.3.1
- CHANGELOG is deprecated - see releases
v0.3.0
- Integrate test-kitchen
- Integrate foodcritic
- Integrate chefspec
- Integrate strainer
- Integrate knife testing
- Add travis support
- Add
persist
key to write tofstab
v0.2.0
- Use fallocate if available - @andrewgross
- Small code restructure
v0.1.1
- Fix error in documentation (it's MB, not GB) (@dougal)
v0.1.0
- Initial release
Foodcritic Metric
0.3.7 failed this metric
FC031: Cookbook without metadata file: /tmp/cook/63f7589b04a6de8fbbf96dc8/swap/metadata.rb:1
FC045: Consider setting cookbook name in metadata: /tmp/cook/63f7589b04a6de8fbbf96dc8/swap/metadata.rb:1
0.3.7 failed this metric
FC045: Consider setting cookbook name in metadata: /tmp/cook/63f7589b04a6de8fbbf96dc8/swap/metadata.rb:1