Last active
December 9, 2015 16:36
-
-
Save maoueh/f85c30d7869294d928c4 to your computer and use it in GitHub Desktop.
Chef bug custom resources and include_recipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/app/recipes/default.rb | |
include_recipe 'common::default' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/common/recipes/default.rb | |
log 'Should log first (in common::default).' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include Chef::DSL::IncludeRecipe | |
action :execute do | |
log "In LWRP, before include_recipe 'root::bootstrap'" | |
include_recipe 'root::bootstrap' | |
log "In LWRP, after include_recipe 'root::bootstrap'" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/root/recipes/bootstrap.rb | |
include_recipe 'common::default' | |
log 'Should log second (in root::boostrap).' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/root/recipes/default.rb | |
root_prepare 'id' | |
include_recipe 'app::default' | |
log 'Should log third (in root::default).' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cookbooks/root/resources/prepare.rb | |
actions :execute | |
default_action :execute | |
attribute :name, :kind_of => String, :name_attribute => true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[root@host sample]# chef-client -z -o 'root' | |
[2015-12-09T16:13:13+00:00] WARN: No config file found or specified on command line, using command line options. | |
Starting Chef Client, version 12.4.3 | |
[2015-12-09T16:13:15+00:00] WARN: Run List override has been provided. | |
[2015-12-09T16:13:15+00:00] WARN: Original Run List: [] | |
[2015-12-09T16:13:15+00:00] WARN: Overridden Run List: [recipe[root]] | |
resolving cookbooks for run list: ["root"] | |
Synchronizing Cookbooks: | |
- common | |
- app | |
- root | |
Compiling Cookbooks... | |
Converging 3 resources | |
Recipe: root::default | |
* root_prepare[id] action execute (up to date) | |
* log[In LWRP, before include_recipe 'root::bootstrap'] action write | |
Recipe: root::bootstrap | |
* log[Should log second (in root::boostrap).] action write | |
* log[In LWRP, after include_recipe 'root::bootstrap'] action write | |
Recipe: common::default | |
* log[Should log first (in common::default).] action write | |
Recipe: root::default | |
* log[Should log third (in root::default).] action write | |
[2015-12-09T16:13:15+00:00] WARN: Skipping final node save because override_runlist was given | |
Running handlers: | |
Running handlers complete | |
Chef Client finished, 5/6 resources updated in 2.154498603 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment