Whyrun
A beta release of whyrun was first released on 2012-07-03 in Chef 10.14.0.beta.1. That beta announcement contains some useful backstory about whyrun and explanation of its usage.
In short, whyrun tells you why Chef would make changes to your system, without executing the changes. It is comparable to a noop or dryrun mode. However, modifying system state has side-effects. For instance, installing a package might also start a service. Thus when we examine what each resource would do individually we fail to acknowledge that there are relationships between resources. Because side-effects are difficult are model, whyrun makes certain assumptions about them to help you predict what would happen, and why. Which is exactly what you're asking of it.
Testing
Whyrun is built into the core providers which was a significant engineering undertaking. Because each environment is different (e.g. platform, cookbooks) it is important for many users to test whyrun to confirm that there is full coverage for their use case.
To help, start by installing Chef with through gems so you can install a pre-release gem.
Installing Omnibus Chef Client on Linux and Mac # Then run: sudo /opt/chef/embedded/bin/gem install chef --pre --no-rdoc --no-ri
Installing Chef Client on Other Operating Systems # Then run: sudo gem install chef --pre --no-rdoc --no-ri
Installing Chef Client on Windows # Then run: gem install chef --pre --no-rdoc --no-ri
| Rubygems arguments --pre installs a prerelease version of a gem |
Run Chef with --why-run and a typical run list for you or find some cookbooks from the community site to try out. Report back here or send an email to the chef mailing list if you have questions. If you want to try Chef on some other systems and you have an EC2 account check out the AMI List for Developers.
If your run list has many resources that are going to change the system, you'll see quite a bit of output and Chef is likely to not be able to model the possible side-effects. Do a regular run (using the nice new output formatters like '-Fdoc -lfatal'!), change something and try whyrun again.
Test Results
An initial list of platforms has been from an old table, but feel free to add others. If someone else has already tested the same platform but you test it under different circumstances, like a different run list, please add a duplicate line right below it.
If you find a place where why-run breaks down, please file a bug. Set the 'Affects Version' field to 10.14.0 (it is under 'Unreleased Versions in the drop down) Most importantly, make sure to set a label of 'whyrun' so we can find the related bugs. See CHEF-3319 for an example. Whyrun will never be able to survive every complex run, but we'll triage the bugs for ones that we think we can fix.
| System Image Note an EC2 AMI or other image type of this system is reproducible by others. |
Operating System |
Tested Date |
Tested By |
Chef Version |
Run List |
System Image* |
Result |
Notes |
|---|---|---|---|---|---|---|---|
Ubuntu 10.04 |
2012-07-30 |
10.14.0.beta.3 |
recipe[tmux], recipe[bind] |
ami-6936fb00 |
Passed |
bind cookbook didn't support this platform |
|
Ubuntu 10.10 |
|
|
|
|
|
|
|
Ubuntu 11.04 |
|
|
|
|
|
|
|
Ubuntu 11.10 |
|
|
|
|
|
|
|
Ubuntu 12.04 |
2012-07-26 |
10.14.0.beta.3 |
recipe['wordpress'] |
ami-b89842d1 |
failed on ruby require |
||
|
|
|
|
|
|
|
|
Debian 5 |
|
|
|
|
|
|
|
Debian 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CentOS 5.6 x86_64 |
2012-07-27 |
10.14.0.beta.3 |
recipe['apache2'] |
|
Passed |
Ran on a Rackspace Cloud server. |
|
CentOS 6.0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RHEL 5.6 |
|
|
|
|
|
|
|
RHEL 5.7 |
|
|
|
|
|
|
|
RHEL 6.0 |
|
|
|
|
|
|
|
RHEL 6.1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SL 5.7 |
|
|
|
|
|
|
|
SL 6.0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OEL 5.7 |
|
|
|
|
|
|
|
OEL 6.1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Fedora 15 |
|
|
|
|
|
|
|
Fedora 16 |
|
|
|
|
|
|
|
Fedora 17 |
2012-07-31 |
10.14.0.beta.3 |
recipe[screen], recipe[postfix] |
ami-08d97e61 |
Passed |
no selinux support, breaks contexts on postfix config files |
|
|
|
|
|
|
|
|
|
Windows 2008 R2 |
|
|
|
|
|
|
|
Windows 2003 R2 |
|
|
|
|
|
|
|
Windows 7 Pro |
2012-08-13 |
10.14.0.beta.3 |
recipe['notepadplusplus'] |
|
Passed |
windows cookbook LWRPs lack whyrun support |
|
|
|
|
|
|
|
|
|
Oracle Solaris 11 |
2012-07-31 |
10.14.0.beta.3 |
created a user |
Needs IPS CHEF-2496 |
test: service, package, cron, group |
||
OpenSolaris (2008.11) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10.7 Mountain Lion |
|
|
|
|
|
|
|
10.7 Lion |
|
|
|
|
|
|
|
10.6 Snow Leopard |
|
|
|
|
|
|
|
10.5 Leopard |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
