diff options
author | Adam Jacob <adam@opscode.com> | 2009-11-27 16:39:16 -0800 |
---|---|---|
committer | Adam Jacob <adam@opscode.com> | 2009-11-27 16:39:16 -0800 |
commit | 13ac6455d30e2964842fd56f370e4c555320cb81 (patch) | |
tree | 90285b594c16688bd14f8a3f333b8c7a4da4ee70 /features | |
parent | 717e256329e72147d141464255ab3e9b20ef4e48 (diff) | |
download | chef-13ac6455d30e2964842fd56f370e4c555320cb81.tar.gz |
Attribute inclusion mixin, and features
Diffstat (limited to 'features')
7 files changed, 57 insertions, 1 deletions
diff --git a/features/data/cookbooks/attribute_include/README.rdoc b/features/data/cookbooks/attribute_include/README.rdoc new file mode 100644 index 0000000000..8d774805b9 --- /dev/null +++ b/features/data/cookbooks/attribute_include/README.rdoc @@ -0,0 +1,8 @@ += DESCRIPTION: + += REQUIREMENTS: + += ATTRIBUTES: + += USAGE: + diff --git a/features/data/cookbooks/attribute_include/attributes/a.rb b/features/data/cookbooks/attribute_include/attributes/a.rb new file mode 100644 index 0000000000..d6edaf4b91 --- /dev/null +++ b/features/data/cookbooks/attribute_include/attributes/a.rb @@ -0,0 +1,4 @@ +include_attribute 'attribute_include::b' +node.set[:mars_volta] = node[:mars_volta_name] +node.set[:mars_volta_is] = node[:mars_volta_will_be] + diff --git a/features/data/cookbooks/attribute_include/attributes/b.rb b/features/data/cookbooks/attribute_include/attributes/b.rb new file mode 100644 index 0000000000..e30b2dc772 --- /dev/null +++ b/features/data/cookbooks/attribute_include/attributes/b.rb @@ -0,0 +1,2 @@ +node.set[:mars_volta_name] = 'mars_volta' +node.set[:mars_volta_will_be] = 'dope' diff --git a/features/data/cookbooks/attribute_include/metadata.rb b/features/data/cookbooks/attribute_include/metadata.rb new file mode 100644 index 0000000000..07c1801d28 --- /dev/null +++ b/features/data/cookbooks/attribute_include/metadata.rb @@ -0,0 +1,6 @@ +maintainer "Opscode" +maintainer_email "do_not_reply@opscode.com" +license "Apache 2.0" +description "Installs/Configures recipe_include" +long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) +version "0.1" diff --git a/features/data/cookbooks/attribute_include/recipes/default.rb b/features/data/cookbooks/attribute_include/recipes/default.rb new file mode 100644 index 0000000000..37d1612938 --- /dev/null +++ b/features/data/cookbooks/attribute_include/recipes/default.rb @@ -0,0 +1,23 @@ +# +# Cookbook Name:: recipe_include +# Recipe:: second +# +# Copyright 2009, Opscode +# +# 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. +# + +execute "append to #{node[:tmpdir]}/mars_volta" do + command "echo '#{node[:mars_volta]} is #{node[:mavolta_is]}' >> #{node[:tmpdir]}/mars_volta" +end + diff --git a/features/data/cookbooks/recipe_include/recipes/default.rb b/features/data/cookbooks/recipe_include/recipes/default.rb index 8132a1c571..f05c067f4b 100644 --- a/features/data/cookbooks/recipe_include/recipes/default.rb +++ b/features/data/cookbooks/recipe_include/recipes/default.rb @@ -1,5 +1,5 @@ # -# Cookbook Name:: recipe_include +# Cookbook Name:: attribute_include # Recipe:: default # # Copyright 2009, Opscode diff --git a/features/language/attribute_inclusion.feature b/features/language/attribute_inclusion.feature new file mode 100644 index 0000000000..d5e8c992c7 --- /dev/null +++ b/features/language/attribute_inclusion.feature @@ -0,0 +1,13 @@ +@language @attribute_inclusion +Feature: Attribute Inclusion + In order to encapsulate functionality and re-use it + As a developer + I want to include an attribute file from another one + + Scenario: Include an attribute directly + Given a validated node + And it includes the recipe 'attribute_include' + When I run the chef-client + Then the run should exit '0' + And a file named 'mars_volta' should contain 'mars_volta is dope' only '1' time + |