Created
June 26, 2014 17:16
-
-
Save btm/f1b01ede282f67caec93 to your computer and use it in GitHub Desktop.
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
PS C:\ruby> chef-apply package.rb | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* log[lolwut ruby] action write (skipped due to only_if) | |
PS C:\ruby> vim .\package.rb | |
PS C:\ruby> chef-apply package.rb | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* log[lolwut ruby] action write | |
PS C:\ruby> chef-apply package.rb -l info | |
[2014-06-26T13:16:07-04:00] INFO: Run List is [] | |
[2014-06-26T13:16:07-04:00] INFO: Run List expands to [] | |
Recipe: (chef-apply cookbook)::(chef-apply recipe) | |
* log[lolwut ruby] action write[2014-06-26T13:16:07-04:00] INFO: Processing log[lolwut ruby] action write ((chef-apply cookbook)::(chef-apply recipe) line 9) | |
[2014-06-26T13:16:07-04:00] INFO: Chef 11.12.8-2 is already installed | |
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
# Only do something if a package is/is not installed on windows, by product code | |
class MsiHelper | |
include Chef::ReservedNames::Win32::API::Installer | |
def installed?(product_code) | |
get_installed_version(product_code) | |
end | |
end | |
log "lolwut ruby" do | |
message "Chef 11.12.8-2 is already installed" | |
only_if { MsiHelper.new.installed?('{0CA254AC-3ACB-4830-9C2F-407F6232BB9C}') } | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment