Module: Chef::DSL::Recipe

Overview

Part of a family of DSL mixins.

Chef::DSL::Recipe mixes into Recipes and Providers.

  • this is restricted to recipe/resource/provider context where a resource collection exists.
  • cookbook authors should typically include modules into here.

Chef::DSL::Universal mixes into Recipes, LWRP Resources+Providers, Core Resources+Providers, and Attributes files.

  • this adds resources and attributes files.
  • do not add helpers which manipulate the resource collection.
  • this is for general-purpose stuff that is useful nearly everywhere.
  • it also pollutes the namespace of nearly every context, watch out.

Instance Method Summary collapse

Methods included from Mixin::LazyModuleInclude

descendants, include, included

Methods included from Definitions

add_definition, #evaluate_resource_definition, #has_resource_definition?

Methods included from Resources

add_resource_dsl, remove_resource_dsl

Methods included from Cheffish

load_cheffish

Methods included from RebootPending

#reboot_pending?

Methods included from PlatformIntrospection

#older_than_win_2012_or_8?, #platform?, #platform_family?, #value_for_platform, #value_for_platform_family

Methods included from RegistryHelper

#registry_data_exists?, #registry_get_subkeys, #registry_get_values, #registry_has_subkeys?, #registry_key_exists?, #registry_value_exists?

Methods included from IncludeRecipe

#include_recipe, #load_recipe

Methods included from Mixin::NotifyingBlock

#notifying_block, #subcontext_block

Methods included from DeclareResource

#build_resource, #declare_resource, #delete_resource, #delete_resource!, #edit_resource, #edit_resource!, #find_resource, #find_resource!, #resources, #with_run_context

Methods included from Mixin::PowershellOut

#powershell_out, #powershell_out!

Methods included from Mixin::WindowsArchitectureHelper

#assert_valid_windows_architecture!, #disable_wow64_file_redirection, #forced_32bit_override_required?, #is_i386_process_on_x86_64_windows?, #node_supports_windows_architecture?, #node_windows_architecture, #restore_wow64_file_redirection, #valid_windows_architecture?, #with_os_architecture, #wow64_architecture_override_required?, #wow64_directory

Methods included from Secret

#default_secret_config, #default_secret_service, #secret, #with_secret_config, #with_secret_service

Methods included from RenderHelpers

#render_json, #render_toml, #render_yaml

Methods included from ReaderHelpers

#parse_file, #parse_json, #parse_toml, #parse_yaml

Methods included from Powershell

#ps_credential

Methods included from ChefVault

#chef_vault, #chef_vault_item, #chef_vault_item_for_environment

Methods included from DataQuery

#data_bag, #data_bag_item, #search, #tagged?

Methods included from EncryptedDataBagItem::CheckEncrypted

#encrypted?

Methods included from Compliance

#include_input, #include_profile, #include_waiver

Instance Method Details

#exec(args) ⇒ Object



66
67
68
# File 'lib/chef/dsl/recipe.rb', line 66

def exec(args)
  raise Chef::Exceptions::ResourceNotFound, "exec was called, but you probably meant to use an execute resource.  If not, please call Kernel#exec explicitly.  The exec block called was \"#{args}\""
end

#have_resource_class_for?(snake_case_name) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
63
64
# File 'lib/chef/dsl/recipe.rb', line 60

def have_resource_class_for?(snake_case_name)
  not resource_class_for(snake_case_name).nil?
rescue NameError
  false
end

#resource_class_for(snake_case_name) ⇒ Object



56
57
58
# File 'lib/chef/dsl/recipe.rb', line 56

def resource_class_for(snake_case_name)
  Chef::Resource.resource_for_node(snake_case_name, run_context.node)
end