Created
December 11, 2014 01:23
-
-
Save spheromak/45bfc4648f2e70ef0b88 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # create_service builds a service resource we can notify in the given context | |
| def create_service(ctx = nil) | |
| ctx ||= @run_context | |
| begin # this avoids resource cloning/recreation | |
| ctx.resource_collection.find("service[#{new_resource.name}]") | |
| rescue Chef::Exceptions::ResourceNotFound | |
| Chef::Log.info "Creating 'service[#{new_resource.name}]' resource in context" | |
| # define the service | |
| s = Chef::Resource::Service.new(new_resource.name, ctx) | |
| s.action :nothing | |
| # add to contexts collection | |
| ctx.resource_collection.insert(s) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment