### Home Classes Methods

### In Files

- lib/chef/resource/smartos_package.rb
- lib/chef/resource/csh.rb
- lib/chef/resource/user.rb
- lib/chef/resource/remote_file.rb
- lib/chef/resource/gem_package.rb
- lib/chef/resource/portage_package.rb
- lib/chef/resource/subversion.rb
- lib/chef/resource/timestamped_deploy.rb
- lib/chef/resource/http_request.rb
- lib/chef/resource/cron.rb
- lib/chef/resource/chef_gem.rb
- lib/chef/resource/conditional.rb
- lib/chef/resource/cookbook_file.rb
- lib/chef/resource/log.rb
- lib/chef/resource/execute.rb
- lib/chef/resource/deploy.rb
- lib/chef/resource/deploy_revision.rb
- lib/chef/resource/file.rb
- lib/chef/resource/ruby_block.rb
- lib/chef/resource/yum_package.rb
- lib/chef/resource/mount.rb
- lib/chef/resource/package.rb
- lib/chef/resource/dpkg_package.rb
- lib/chef/resource/env.rb
- lib/chef/resource/template.rb
- lib/chef/resource/erl_call.rb
- lib/chef/resource/perl.rb
- lib/chef/resource/macports_package.rb
- lib/chef/resource/ips_package.rb
- lib/chef/resource/group.rb
- lib/chef/resource/git.rb
- lib/chef/resource/bash.rb
- lib/chef/resource/link.rb
- lib/chef/resource/service.rb
- lib/chef/resource/scm.rb
- lib/chef/resource/rpm_package.rb
- lib/chef/resource/solaris_package.rb
- lib/chef/resource/mdadm.rb
- lib/chef/resource/freebsd_package.rb
- lib/chef/resource/script.rb
- lib/chef/resource/ifconfig.rb
- lib/chef/resource/pacman_package.rb
- lib/chef/resource/python.rb
- lib/chef/resource/route.rb
- lib/chef/resource/breakpoint.rb
- lib/chef/resource/apt_package.rb
- lib/chef/resource/directory.rb
- lib/chef/resource/ruby.rb
- lib/chef/resource/remote_directory.rb
- lib/chef/resource/ohai.rb
- lib/chef/resource/easy_install_package.rb
- lib/chef/resource_platform_map.rb
- lib/chef/resource.rb

### Parent

Object

### Namespace

- CLASS Chef::Resource::AptPackage
- CLASS Chef::Resource::Bash
- CLASS Chef::Resource::Breakpoint
- CLASS Chef::Resource::ChefGem
- CLASS Chef::Resource::Conditional
- CLASS Chef::Resource::CookbookFile
- CLASS Chef::Resource::Cron
- CLASS Chef::Resource::Csh
- CLASS Chef::Resource::Deploy
- CLASS Chef::Resource::DeployBranch
- CLASS Chef::Resource::DeployRevision
- CLASS Chef::Resource::Directory
- CLASS Chef::Resource::DpkgPackage
- CLASS Chef::Resource::EasyInstallPackage
- CLASS Chef::Resource::Env
- CLASS Chef::Resource::ErlCall
- CLASS Chef::Resource::Execute
- CLASS Chef::Resource::File
- CLASS Chef::Resource::FreebsdPackage
- CLASS Chef::Resource::GemPackage
- CLASS Chef::Resource::Git
- CLASS Chef::Resource::Group
- CLASS Chef::Resource::HttpRequest
- CLASS Chef::Resource::Ifconfig
- CLASS Chef::Resource::IpsPackage
- CLASS Chef::Resource::Link
- CLASS Chef::Resource::Log
- CLASS Chef::Resource::MacportsPackage
- CLASS Chef::Resource::Mdadm
- CLASS Chef::Resource::Mount
- CLASS Chef::Resource::Notification
- CLASS Chef::Resource::Ohai
- CLASS Chef::Resource::Package
- CLASS Chef::Resource::PacmanPackage
- CLASS Chef::Resource::Perl
- CLASS Chef::Resource::PlatformMap
- CLASS Chef::Resource::PortagePackage
- CLASS Chef::Resource::Python
- CLASS Chef::Resource::RemoteDirectory
- CLASS Chef::Resource::RemoteFile
- CLASS Chef::Resource::Route
- CLASS Chef::Resource::RpmPackage
- CLASS Chef::Resource::Ruby
- CLASS Chef::Resource::RubyBlock
- CLASS Chef::Resource::Scm
- CLASS Chef::Resource::Script
- CLASS Chef::Resource::Service
- CLASS Chef::Resource::SmartOSPackage
- CLASS Chef::Resource::SolarisPackage
- CLASS Chef::Resource::Subversion
- CLASS Chef::Resource::Template
- CLASS Chef::Resource::TimestampedDeploy
- CLASS Chef::Resource::User
- CLASS Chef::Resource::YumPackage

### Methods

- ::attribute
- ::build_from_file
- ::dsl_name
- ::find_subclass_by_name
- ::identity_attr
- ::inherited
- ::json_create
- ::new
- ::platform_map
- ::provider_base
- ::provides
- ::resource_classes
- ::resource_for_node
- ::resource_for_platform
- ::state_attrs
- #action
- #add_notification
- #after_created
- #as_json
- #cookbook_version
- #customize_exception
- #defined_at
- #delayed_notifications
- #epic_fail
- #events
- #identity
- #ignore_failure
- #immediate_notifications
- #inspect
- #is
- #load_prior_resource
- #method_missing
- #name
- #node
- #noop
- #not_if
- #notifies
- #notifies_delayed
- #notifies_immediately
- #only_if
- #provider_for_action
- #resolve_notification_references
- #resources
- #run_action
- #should_skip?
- #state
- #subscribes
- #supports
- #to_hash
- #to_json
- #to_s
- #to_text
- #updated=
- #updated?
- #updated_by_last_action
- #updated_by_last_action?
- #validate_action

### Included Modules

- Chef::Mixin::CheckHelper
- Chef::Mixin::ParamsValidate
- Chef::Mixin::Language
- Chef::Mixin::ConvertToClassName
- Chef::Mixin::Deprecation

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Chef
- Chef::ApiClient
- Chef::Application
- Chef::Application::Client
- Chef::Application::Knife
- Chef::Application::Solo
- Chef::Application::Wakeup
- Chef::Application::WindowsService
- Chef::Certificate
- Chef::Checksum
- Chef::Checksum::Storage
- Chef::Checksum::Storage::Filesystem
- Chef::ChecksumCache
- Chef::Client
- Chef::Config
- Chef::Cookbook
- Chef::Cookbook::Chefignore
- Chef::Cookbook::CookbookVersionLoader
- Chef::Cookbook::FileSystemFileVendor
- Chef::Cookbook::FileVendor
- Chef::Cookbook::Metadata
- Chef::Cookbook::MinimalMetadata
- Chef::Cookbook::RemoteFileVendor
- Chef::Cookbook::SyntaxCheck
- Chef::CookbookCacheCleaner
- Chef::CookbookCollection
- Chef::CookbookLoader
- Chef::CookbookSiteStreamingUploader
- Chef::CookbookSiteStreamingUploader::MultipartStream
- Chef::CookbookSiteStreamingUploader::StreamPart
- Chef::CookbookSiteStreamingUploader::StringPart
- Chef::CookbookSynchronizer
- Chef::CookbookUploader
- Chef::CookbookVersion
- Chef::CookbookVersionSelector
- Chef::CouchDB
- Chef::Daemon
- Chef::DataBag
- Chef::DataBagItem
- Chef::EncryptedDataBagItem
- Chef::EncryptedDataBagItem::DecryptionFailure
- Chef::EncryptedDataBagItem::Decryptor
- Chef::EncryptedDataBagItem::Decryptor::Version0Decryptor
- Chef::EncryptedDataBagItem::Decryptor::Version1Decryptor
- Chef::EncryptedDataBagItem::UnsupportedCipher
- Chef::EncryptedDataBagItem::UnsupportedEncryptedDataBagItemFormat
- Chef::Environment
- Chef::EventDispatch
- Chef::EventDispatch::Base
- Chef::EventDispatch::Dispatcher
- Chef::Exceptions
- Chef::Exceptions::AmbiguousRunlistSpecification
- Chef::Exceptions::Application
- Chef::Exceptions::AttributeNotFound
- Chef::Exceptions::CannotDetermineNodeName
- Chef::Exceptions::CannotWritePrivateKey
- Chef::Exceptions::CommandTimeout
- Chef::Exceptions::ConfigurationError
- Chef::Exceptions::CookbookFrozen
- Chef::Exceptions::CookbookNotFound
- Chef::Exceptions::CookbookNotFoundInRepo
- Chef::Exceptions::CookbookVersionConflict
- Chef::Exceptions::CookbookVersionNameMismatch
- Chef::Exceptions::CookbookVersionSelection
- Chef::Exceptions::CookbookVersionSelection::InvalidRunListItems
- Chef::Exceptions::CookbookVersionSelection::UnsatisfiableRunListItem
- Chef::Exceptions::CouchDBNotFound
- Chef::Exceptions::Cron
- Chef::Exceptions::DsclCommandFailed
- Chef::Exceptions::EnclosingDirectoryDoesNotExist
- Chef::Exceptions::Env
- Chef::Exceptions::ErlCall
- Chef::Exceptions::Exec
- Chef::Exceptions::FileNotFound
- Chef::Exceptions::Group
- Chef::Exceptions::GroupIDNotFound
- Chef::Exceptions::Ifconfig
- Chef::Exceptions::IllegalChecksumRevert
- Chef::Exceptions::InsufficientPermissions
- Chef::Exceptions::InvalidCommandOption
- Chef::Exceptions::InvalidCookbookVersion
- Chef::Exceptions::InvalidDataBagItemID
- Chef::Exceptions::InvalidDataBagName
- Chef::Exceptions::InvalidDataBagPath
- Chef::Exceptions::InvalidEnvironmentRunListSpecification
- Chef::Exceptions::InvalidHomeDirectory
- Chef::Exceptions::InvalidPrivateKey
- Chef::Exceptions::InvalidRemoteGitReference
- Chef::Exceptions::InvalidResourceReference
- Chef::Exceptions::InvalidResourceSpecification
- Chef::Exceptions::InvalidVersionConstraint
- Chef::Exceptions::Link
- Chef::Exceptions::MissingLibrary
- Chef::Exceptions::MissingParentDirectory
- Chef::Exceptions::MissingRole
- Chef::Exceptions::Mount
- Chef::Exceptions::ObsoleteDependencySyntax
- Chef::Exceptions::Override
- Chef::Exceptions::Package
- Chef::Exceptions::PrivateKeyMissing
- Chef::Exceptions::QueryParseError
- Chef::Exceptions::RecipeNotFound
- Chef::Exceptions::RedirectLimitExceeded
- Chef::Exceptions::RequestedUIDUnavailable
- Chef::Exceptions::ResourceNotFound
- Chef::Exceptions::RoleNotFound
- Chef::Exceptions::Route
- Chef::Exceptions::SearchIndex
- Chef::Exceptions::Service
- Chef::Exceptions::ShellCommandFailed
- Chef::Exceptions::SolrConnectionError
- Chef::Exceptions::UnresolvableGitReference
- Chef::Exceptions::UnsupportedAction
- Chef::Exceptions::User
- Chef::Exceptions::UserIDNotFound
- Chef::Exceptions::ValidationFailed
- Chef::Exceptions::Win32APIError
- Chef::Exceptions::Win32APIFunctionNotImplemented
- Chef::FileAccessControl
- Chef::FileAccessControl::Unix
- Chef::FileAccessControl::Windows
- Chef::FileAccessControl::Windows::Security
- Chef::FileCache
- Chef::Formatters
- Chef::Formatters::APIErrorFormatting
- Chef::Formatters::Base
- Chef::Formatters::Doc
- Chef::Formatters::ErrorDescription
- Chef::Formatters::ErrorInspectors
- Chef::Formatters::ErrorInspectors::CompileErrorInspector
- Chef::Formatters::ErrorInspectors::CookbookResolveErrorInspector
- Chef::Formatters::ErrorInspectors::CookbookSyncErrorInspector
- Chef::Formatters::ErrorInspectors::NodeLoadErrorInspector
- Chef::Formatters::ErrorInspectors::RegistrationErrorInspector
- Chef::Formatters::ErrorInspectors::ResourceFailureInspector
- Chef::Formatters::ErrorInspectors::RunListExpansionErrorInspector
- Chef::Formatters::ErrorMapper
- Chef::Formatters::Minimal
- Chef::Formatters::NullFormatter
- Chef::Formatters::Outputter
- Chef::Formatters::UnknownFormatter
- Chef::Handler
- Chef::Handler::ErrorReport
- Chef::Handler::JsonFile
- Chef::IndexQueue
- Chef::IndexQueue::AmqpClient
- Chef::IndexQueue::Consumer
- Chef::IndexQueue::Consumer::ClassMethods
- Chef::IndexQueue::Indexable
- Chef::IndexQueue::Indexable::ClassMethods
- Chef::JSONCompat
- Chef::Knife
- Chef::Knife::Bootstrap
- Chef::Knife::ClientBulkDelete
- Chef::Knife::ClientCreate
- Chef::Knife::ClientDelete
- Chef::Knife::ClientEdit
- Chef::Knife::ClientList
- Chef::Knife::ClientReregister
- Chef::Knife::ClientShow
- Chef::Knife::Configure
- Chef::Knife::ConfigureClient
- Chef::Knife::CookbookBulkDelete
- Chef::Knife::CookbookCreate
- Chef::Knife::CookbookDelete
- Chef::Knife::CookbookDownload
- Chef::Knife::CookbookList
- Chef::Knife::CookbookMetadata
- Chef::Knife::CookbookMetadataFromFile
- Chef::Knife::CookbookSCMRepo
- Chef::Knife::CookbookShow
- Chef::Knife::CookbookSiteDownload
- Chef::Knife::CookbookSiteInstall
- Chef::Knife::CookbookSiteList
- Chef::Knife::CookbookSiteSearch
- Chef::Knife::CookbookSiteShare
- Chef::Knife::CookbookSiteShow
- Chef::Knife::CookbookSiteUnshare
- Chef::Knife::CookbookSiteVendor
- Chef::Knife::CookbookTest
- Chef::Knife::CookbookUpload
- Chef::Knife::Core
- Chef::Knife::Core::BootstrapContext
- Chef::Knife::Core::GenericPresenter
- Chef::Knife::Core::NodeFormattingOptions
- Chef::Knife::Core::NodePresenter
- Chef::Knife::Core::ObjectLoader
- Chef::Knife::Core::ObjectLoader::ObjectType
- Chef::Knife::Core::TextFormatter
- Chef::Knife::DataBagCreate
- Chef::Knife::DataBagDelete
- Chef::Knife::DataBagEdit
- Chef::Knife::DataBagFromFile
- Chef::Knife::DataBagList
- Chef::Knife::DataBagShow
- Chef::Knife::EnvironmentCreate
- Chef::Knife::EnvironmentDelete
- Chef::Knife::EnvironmentEdit
- Chef::Knife::EnvironmentFromFile
- Chef::Knife::EnvironmentList
- Chef::Knife::EnvironmentShow
- Chef::Knife::Exec
- Chef::Knife::Help
- Chef::Knife::IndexRebuild
- Chef::Knife::NodeBulkDelete
- Chef::Knife::NodeCreate
- Chef::Knife::NodeDelete
- Chef::Knife::NodeEdit
- Chef::Knife::NodeEditor
- Chef::Knife::NodeFromFile
- Chef::Knife::NodeList
- Chef::Knife::NodeRunListAdd
- Chef::Knife::NodeRunListRemove
- Chef::Knife::NodeShow
- Chef::Knife::RecipeList
- Chef::Knife::RoleBulkDelete
- Chef::Knife::RoleCreate
- Chef::Knife::RoleDelete
- Chef::Knife::RoleEdit
- Chef::Knife::RoleFromFile
- Chef::Knife::RoleList
- Chef::Knife::RoleShow
- Chef::Knife::Search
- Chef::Knife::Ssh
- Chef::Knife::Status
- Chef::Knife::SubcommandLoader
- Chef::Knife::TagCreate
- Chef::Knife::TagDelete
- Chef::Knife::TagList
- Chef::Knife::UI
- Chef::Log
- Chef::Log::Formatter
- Chef::MinimalCookbookVersion
- Chef::Mixin
- Chef::Mixin::CheckHelper
- Chef::Mixin::Checksum
- Chef::Mixin::Command
- Chef::Mixin::Command::Unix
- Chef::Mixin::Command::Windows
- Chef::Mixin::ConvertToClassName
- Chef::Mixin::CreatePath
- Chef::Mixin::DeepMerge
- Chef::Mixin::DeepMerge::InvalidParameter
- Chef::Mixin::Deprecation
- Chef::Mixin::Deprecation::DeprecatedInstanceVariable
- Chef::Mixin::Deprecation::DeprecatedObjectProxyBase
- Chef::Mixin::EnforceOwnershipAndPermissions
- Chef::Mixin::FileClass
- Chef::Mixin::FromFile
- Chef::Mixin::GetSourceFromPackage
- Chef::Mixin::Language
- Chef::Mixin::Language::PlatformDependentValue
- Chef::Mixin::Language::PlatformFamilyDependentValue
- Chef::Mixin::LanguageIncludeAttribute
- Chef::Mixin::LanguageIncludeRecipe
- Chef::Mixin::ParamsValidate
- Chef::Mixin::PathSanity
- Chef::Mixin::RecipeDefinitionDSLCore
- Chef::Mixin::Securable
- Chef::Mixin::ShellOut
- Chef::Mixin::Template
- Chef::Mixin::Template::ChefContext
- Chef::Mixin::Template::TemplateError
- Chef::Mixin::WhyRun
- Chef::Mixin::WhyRun::ConvergeActions
- Chef::Mixin::WhyRun::ResourceRequirements
- Chef::Mixin::WhyRun::ResourceRequirements::Assertion
- Chef::Mixin::WhyRun::ResourceRequirements::Assertion::AssertionFailure
- Chef::Mixin::XMLEscape
- Chef::Mixin::XMLEscape::FastXS
- Chef::Mixin::XMLEscape::PureRuby
- Chef::Node
- Chef::Node::Attribute
- Chef::OpenIDRegistration
- Chef::Platform
- Chef::Provider
- Chef::Provider::Breakpoint
- Chef::Provider::CookbookFile
- Chef::Provider::Cron
- Chef::Provider::Cron::Solaris
- Chef::Provider::Deploy
- Chef::Provider::Deploy::Revision
- Chef::Provider::Deploy::Timestamped
- Chef::Provider::Directory
- Chef::Provider::Env
- Chef::Provider::Env::Windows
- Chef::Provider::ErlCall
- Chef::Provider::Execute
- Chef::Provider::File
- Chef::Provider::Git
- Chef::Provider::Group
- Chef::Provider::Group::Aix
- Chef::Provider::Group::Dscl
- Chef::Provider::Group::Gpasswd
- Chef::Provider::Group::Groupadd
- Chef::Provider::Group::Groupmod
- Chef::Provider::Group::Pw
- Chef::Provider::Group::Suse
- Chef::Provider::Group::Usermod
- Chef::Provider::Group::Windows
- Chef::Provider::HttpRequest
- Chef::Provider::Ifconfig
- Chef::Provider::Link
- Chef::Provider::Log
- Chef::Provider::Log::ChefLog
- Chef::Provider::Mdadm
- Chef::Provider::Mount
- Chef::Provider::Mount::Mount
- Chef::Provider::Mount::Windows
- Chef::Provider::Ohai
- Chef::Provider::Package
- Chef::Provider::Package::Apt
- Chef::Provider::Package::Dpkg
- Chef::Provider::Package::EasyInstall
- Chef::Provider::Package::Freebsd
- Chef::Provider::Package::Ips
- Chef::Provider::Package::Macports
- Chef::Provider::Package::Pacman
- Chef::Provider::Package::Portage
- Chef::Provider::Package::Rpm
- Chef::Provider::Package::Rubygems
- Chef::Provider::Package::Rubygems::AlternateGemEnvironment
- Chef::Provider::Package::Rubygems::CurrentGemEnvironment
- Chef::Provider::Package::Rubygems::GemEnvironment
- Chef::Provider::Package::SmartOS
- Chef::Provider::Package::Solaris
- Chef::Provider::Package::Yum
- Chef::Provider::Package::Yum::RPMDb
- Chef::Provider::Package::Yum::RPMDbPackage
- Chef::Provider::Package::Yum::RPMDependency
- Chef::Provider::Package::Yum::RPMPackage
- Chef::Provider::Package::Yum::RPMProvide
- Chef::Provider::Package::Yum::RPMRequire
- Chef::Provider::Package::Yum::RPMUtils
- Chef::Provider::Package::Yum::RPMVersion
- Chef::Provider::Package::Yum::YumCache
- Chef::Provider::Package::Zypper
- Chef::Provider::RemoteDirectory
- Chef::Provider::RemoteFile
- Chef::Provider::ResourceUpdate
- Chef::Provider::Route
- Chef::Provider::RubyBlock
- Chef::Provider::Script
- Chef::Provider::Service
- Chef::Provider::Service::Arch
- Chef::Provider::Service::Debian
- Chef::Provider::Service::Freebsd
- Chef::Provider::Service::Gentoo
- Chef::Provider::Service::Init
- Chef::Provider::Service::Insserv
- Chef::Provider::Service::Invokercd
- Chef::Provider::Service::Macosx
- Chef::Provider::Service::Redhat
- Chef::Provider::Service::Simple
- Chef::Provider::Service::Solaris
- Chef::Provider::Service::Systemd
- Chef::Provider::Service::Upstart
- Chef::Provider::Service::Windows
- Chef::Provider::Subversion
- Chef::Provider::Template
- Chef::Provider::User
- Chef::Provider::User::Dscl
- Chef::Provider::User::Pw
- Chef::Provider::User::Useradd
- Chef::Provider::User::Windows
- Chef::REST
- Chef::REST::AuthCredentials
- Chef::REST::CookieJar
- Chef::REST::NoopInflater
- Chef::REST::RESTRequest
- Chef::Recipe
- Chef::ReservedNames
- Chef::ReservedNames::Win32
- Chef::ReservedNames::Win32::API
- Chef::ReservedNames::Win32::API::Error
- Chef::ReservedNames::Win32::API::File
- Chef::ReservedNames::Win32::API::File::BY_HANDLE_FILE_INFORMATION
- Chef::ReservedNames::Win32::API::File::FILETIME
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_GENERIC
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_MOUNT_POINT
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_SYMBOLIC_LINK
- Chef::ReservedNames::Win32::API::File::REPARSE_DATA_BUFFER_UNION
- Chef::ReservedNames::Win32::API::File::SECURITY_ATTRIBUTES
- Chef::ReservedNames::Win32::API::File::WIN32_FIND_DATA
- Chef::ReservedNames::Win32::API::Macros
- Chef::ReservedNames::Win32::API::Memory
- Chef::ReservedNames::Win32::API::PSAPI
- Chef::ReservedNames::Win32::API::PSAPI::PROCESS_MEMORY_COUNTERS
- Chef::ReservedNames::Win32::API::Process
- Chef::ReservedNames::Win32::API::Security
- Chef::ReservedNames::Win32::API::Security::ACE_HEADER
- Chef::ReservedNames::Win32::API::Security::ACE_WITH_MASK_AND_SID
- Chef::ReservedNames::Win32::API::Security::ACLStruct
- Chef::ReservedNames::Win32::API::Security::LUID
- Chef::ReservedNames::Win32::API::Security::LUID_AND_ATTRIBUTES
- Chef::ReservedNames::Win32::API::Security::TOKEN_PRIVILEGES
- Chef::ReservedNames::Win32::API::System
- Chef::ReservedNames::Win32::API::System::OSVERSIONINFOEX
- Chef::ReservedNames::Win32::API::Unicode
- Chef::ReservedNames::Win32::Error
- Chef::ReservedNames::Win32::File
- Chef::ReservedNames::Win32::File::Info
- Chef::ReservedNames::Win32::Handle
- Chef::ReservedNames::Win32::Memory
- Chef::ReservedNames::Win32::Process
- Chef::ReservedNames::Win32::Security
- Chef::ReservedNames::Win32::Security::ACE
- Chef::ReservedNames::Win32::Security::ACL
- Chef::ReservedNames::Win32::Security::SID
- Chef::ReservedNames::Win32::Security::SecurableObject
- Chef::ReservedNames::Win32::Security::SecurityDescriptor
- Chef::ReservedNames::Win32::Security::Token
- Chef::ReservedNames::Win32::Unicode
- Chef::ReservedNames::Win32::Version
- Chef::Resource
- Chef::Resource::AptPackage
- Chef::Resource::Bash
- Chef::Resource::Breakpoint
- Chef::Resource::ChefGem
- Chef::Resource::Conditional
- Chef::Resource::CookbookFile
- Chef::Resource::Cron
- Chef::Resource::Csh
- Chef::Resource::Deploy
- Chef::Resource::DeployBranch
- Chef::Resource::DeployRevision
- Chef::Resource::Directory
- Chef::Resource::DpkgPackage
- Chef::Resource::EasyInstallPackage
- Chef::Resource::Env
- Chef::Resource::ErlCall
- Chef::Resource::Execute
- Chef::Resource::File
- Chef::Resource::FreebsdPackage
- Chef::Resource::GemPackage
- Chef::Resource::Git
- Chef::Resource::Group
- Chef::Resource::HttpRequest
- Chef::Resource::Ifconfig
- Chef::Resource::IpsPackage
- Chef::Resource::Link
- Chef::Resource::Log
- Chef::Resource::MacportsPackage
- Chef::Resource::Mdadm
- Chef::Resource::Mount
- Chef::Resource::Notification
- Chef::Resource::Ohai
- Chef::Resource::Package
- Chef::Resource::PacmanPackage
- Chef::Resource::Perl
- Chef::Resource::PlatformMap
- Chef::Resource::PortagePackage
- Chef::Resource::Python
- Chef::Resource::RemoteDirectory
- Chef::Resource::RemoteFile
- Chef::Resource::Route
- Chef::Resource::RpmPackage
- Chef::Resource::Ruby
- Chef::Resource::RubyBlock
- Chef::Resource::Scm
- Chef::Resource::Script
- Chef::Resource::Service
- Chef::Resource::SmartOSPackage
- Chef::Resource::SolarisPackage
- Chef::Resource::Subversion
- Chef::Resource::Template
- Chef::Resource::TimestampedDeploy
- Chef::Resource::User
- Chef::Resource::YumPackage
- Chef::ResourceCollection
- Chef::ResourceCollection::StepableIterator
- Chef::ResourceDefinition
- Chef::ResourceDefinitionList
- Chef::ResourceReporter
- Chef::ResourceReporter::ResourceReport
- Chef::Role
- Chef::RunContext
- Chef::RunList
- Chef::RunList::RunListExpansion
- Chef::RunList::RunListExpansionFromAPI
- Chef::RunList::RunListExpansionFromCouchDB
- Chef::RunList::RunListExpansionFromDisk
- Chef::RunList::RunListItem
- Chef::RunList::VersionedRecipeList
- Chef::RunStatus
- Chef::Runner
- Chef::Sandbox
- Chef::ScanAccessControl
- Chef::Search
- Chef::Search::Query
- Chef::ShellOut
- Chef::SolrQuery
- Chef::SolrQuery::QueryTransform
- Chef::SolrQuery::SolrHTTPRequest
- Chef::StreamingCookbookUploader
- Chef::StreamingCookbookUploader::MultipartStream
- Chef::StreamingCookbookUploader::StreamPart
- Chef::StreamingCookbookUploader::StringPart
- Chef::Util
- Chef::Util::FileEdit
- Chef::Util::Windows
- Chef::Util::Windows::NetGroup
- Chef::Util::Windows::NetUse
- Chef::Util::Windows::NetUser
- Chef::Util::Windows::Volume
- Chef::Version
- Chef::VersionConstraint
- Chef::WebUIUser
- Lucene
- Lucene::AndOperator
- Lucene::BinaryOp
- Lucene::Body
- Lucene::BoostOp
- Lucene::ExclFieldRange
- Lucene::Field
- Lucene::FieldName
- Lucene::FieldRange
- Lucene::FuzzyOp
- Lucene::FuzzyParam
- Lucene::Group
- Lucene::InclFieldRange
- Lucene::NotOperator
- Lucene::OrOperator
- Lucene::Phrase
- Lucene::ProhibitedOperator
- Lucene::RangeValue
- Lucene::RequiredOperator
- Lucene::Term
- Lucene::UnaryOp
- Shef
- Shef::ClientSession
- Shef::DoppelGangerClient
- Shef::DoppelGangerSession
- Shef::Extensions
- Shef::Extensions::FalseClass
- Shef::Extensions::ObjectCoreExtensions
- Shef::Extensions::String
- Shef::Extensions::Symbol
- Shef::Extensions::TrueClass
- Shef::ModelWrapper
- Shef::NamedDataBagWrapper
- Shef::Options
- Shef::ShefREST
- Shef::ShefSession
- Shef::SoloSession
- Shef::StandAloneSession
- Net
- Net::HTTPError
- Net::HTTPFatalError
- Net::HTTPRetriableError
- Net::HTTPServerException
- Moneta
- Moneta::BasicFile
- Moneta::Defaults
- FFI
- FFI::Pointer
- FileUtils
- FileUtils::Entry_
- ChefNetHTTPExceptionExtensions
- Dir
- FalseClass
- Mash
- Numeric
- Object
- Regexp
- String
- Symbol
- TrueClass

No matching classes.

# Chef::Resource

### Constants

FORBIDDEN_IVARS
HIDDEN_IVARS

### Attributes

allowed_actions[RW]
cookbook_name[RW]
elapsed_time[R]
enclosing_provider[RW]
not_if_args[R]
only_if_args[R]
params[RW]
provider[RW]
recipe_name[RW]
resource_name[R]
retries[RW]
retry_delay[RW]
run_context[RW]
source_line[RW]
updated[R]

### Public Class Methods

attribute(attr_name, validation_opts={}) click to toggle source

    # File lib/chef/resource.rb, line 709
    def self.attribute(attr_name, validation_opts={})
      # This atrocity is the only way to support 1.8 and 1.9 at the same time
      # When you're ready to drop 1.8 support, do this:
      # define_method attr_name.to_sym do |arg=nil|
      # etc.
      shim_method=      def #{attr_name}(arg=nil)        _set_or_return_#{attr_name}(arg)      end
      class_eval(shim_method)

      define_method("_set_or_return_#{attr_name.to_s}".to_sym) do |arg|
        set_or_return(attr_name.to_sym, arg, validation_opts)
      end
    end

build_from_file(cookbook_name, filename, run_context) click to toggle source

    # File lib/chef/resource.rb, line 726
    def self.build_from_file(cookbook_name, filename, run_context)
      rname = filename_to_qualified_string(cookbook_name, filename)

      # Add log entry if we override an existing light-weight resource.
      class_name = convert_to_class_name(rname)
      overriding = Chef::Resource.const_defined?(class_name)
      Chef::Log.info("#{class_name} light-weight resource already initialized -- overriding!") if overriding

      new_resource_class = Class.new self do |cls|

        # default initialize method that ensures that when initialize is finally
        # wrapped (see below), super is called in the event that the resource
        # definer does not implement initialize
        def initialize(name, run_context)
          super(name, run_context)
        end

        @actions_to_create = []

        class << cls
          include Chef::Mixin::FromFile

          attr_accessor :run_context
          attr_reader :action_to_set_default

          def node
            self.run_context.node
          end

          def actions_to_create
            @actions_to_create
          end

          define_method(:default_action) do |action_name|
            actions_to_create.push(action_name)
            @action_to_set_default = action_name
          end

          define_method(:actions) do |*action_names|
            actions_to_create.push(*action_names)
          end
        end

        # set the run context in the class instance variable
        cls.run_context = run_context

        # load resource definition from file
        cls.class_from_file(filename)

        # create a new constructor that wraps the old one and adds the actions
        # specified in the DSL
        old_init = instance_method(:initialize)

        define_method(:initialize) do |name, *optional_args|
          args_run_context = optional_args.shift
          @resource_name = rname.to_sym
          old_init.bind(self).call(name, args_run_context)
          @action = self.class.action_to_set_default || @action
          allowed_actions.push(self.class.actions_to_create).flatten!
        end
      end

      # register new class as a Chef::Resource
      class_name = convert_to_class_name(rname)
      Chef::Resource.const_set(class_name, new_resource_class)
      Chef::Log.debug("Loaded contents of #{filename} into a resource named #{rname} defined in Chef::Resource::#{class_name}")

      new_resource_class
    end

dsl_name() click to toggle source

    # File lib/chef/resource.rb, line 189
    def self.dsl_name
      convert_to_snake_case(name, 'Chef::Resource')
    end

find_subclass_by_name(class_name) click to toggle source

Look up a subclass by `class_name` which should be a string that matches `Subclass.name`

    # File lib/chef/resource.rb, line 135
    def self.find_subclass_by_name(class_name)
      resource_classes.first {|c| c.name == class_name }
    end

identity_attr(attr_name=nil) click to toggle source

Set or return the "identity attribute" for this resource class. This is generally going to be the "name attribute" for this resource. In other words, the resource type plus this attribute uniquely identify a given bit of state that chef manages. For a File resource, this would be the path, for a package resource, it will be the package name. This will show up in chef-client's audit records as a searchable field.

    # File lib/chef/resource.rb, line 177
    def self.identity_attr(attr_name=nil)
      @identity_attr ||= nil
      @identity_attr = attr_name if attr_name

      # If this class doesn't have an identity attr, we'll defer to the superclass:
      if @identity_attr || !superclass.respond_to?(:identity_attr)
        @identity_attr
      else
        superclass.identity_attr
      end
    end

inherited(subclass) click to toggle source

Callback when subclass is defined. Adds subclass to list of subclasses.

    # File lib/chef/resource.rb, line 129
    def self.inherited(subclass)
      resource_classes << subclass
    end

json_create(o) click to toggle source

    # File lib/chef/resource.rb, line 694
    def self.json_create(o)
      resource = self.new(o["instance_vars"]["@name"])
      o["instance_vars"].each do |k,v|
        resource.instance_variable_set("@#{k}".to_sym, v)
      end
      resource
    end

new(name, run_context=nil) click to toggle source

Each notify entry is a resource/action pair, modeled as an Struct with a resource and action member

    # File lib/chef/resource.rb, line 215
    def initialize(name, run_context=nil)
      @name = name
      @run_context = run_context
      @noop = nil
      @before = nil
      @params = Hash.new
      @provider = nil
      @allowed_actions = [ :nothing ]
      @action = :nothing
      @updated = false
      @updated_by_last_action = false
      @supports = {}
      @ignore_failure = false
      @retries = 0
      @retry_delay = 2
      @not_if = []
      @only_if = []
      @source_line = nil
      @elapsed_time = 0

      @node = run_context ? deprecated_ivar(run_context.node, :node, :warn) : nil
    end

platform_map() click to toggle source

    # File lib/chef/resource.rb, line 808
    def self.platform_map
      @@platform_map ||= PlatformMap.new
    end

provider_base(arg=nil) click to toggle source

Resources that want providers namespaced somewhere other than Chef::Provider can set the namespace with `provider_base` Ex:

    class MyResource < Chef::Resource
      provider_base Chef::Provider::Deploy
      # ...other stuff
    end

    # File lib/chef/resource.rb, line 803
    def self.provider_base(arg=nil)
      @provider_base ||= arg
      @provider_base ||= Chef::Provider
    end

provides(short_name, opts={}) click to toggle source

Maps a short_name (and optionally a platform and version) to a Chef::Resource. This allows finer grained per platform resource attributes and the end of overloaded resource definitions (I'm looking at you Chef::Resource::Package) Ex:

    class WindowsFile < Chef::Resource
      provides :file, :on_platforms => ["windows"]
      # ...other stuff
    end

TODO: 2011-11-02 schisamo - platform_version support

    # File lib/chef/resource.rb, line 823
    def self.provides(short_name, opts={})
      short_name_sym = short_name
      if short_name.kind_of?(String)
        short_name.downcase!
        short_name.gsub!(/\s/, "_")
        short_name_sym = short_name.to_sym
      end
      if opts.has_key?(:on_platforms)
        platforms = [opts[:on_platforms]].flatten
        platforms.each do |p|
          p = :default if :all == p.to_sym
          platform_map.set(
            :platform => p.to_sym,
            :short_name => short_name_sym,
            :resource => self
          )
        end
      else
        platform_map.set(
          :short_name => short_name_sym,
          :resource => self
        )
      end
    end

resource_classes() click to toggle source

Track all subclasses of Resource. This is used so names can be looked up when attempting to deserialize from JSON. (See: json_compat)

    # File lib/chef/resource.rb, line 124
    def self.resource_classes
      @resource_classes ||= []
    end

resource_for_node(short_name, node) click to toggle source

Returns a resource based on a short_name and a node's platform and version.

#### Parameters

short_name<Symbol> | short_name of the resource (ie :directory)
node<Chef::Node> | Node object to look up platform and version in

### Returns

<Chef::Resource> | returns the proper Chef::Resource class

    # File lib/chef/resource.rb, line 871
    def self.resource_for_node(short_name, node)
      begin
        platform, version = Chef::Platform.find_platform_and_version(node)
      rescue ArgumentError
      end
      resource = resource_for_platform(short_name, platform, version)
      resource
    end

resource_for_platform(short_name, platform=nil, version=nil) click to toggle source

Returns a resource based on a short_name anda platform and version.

#### Parameters

short_name<Symbol> | short_name of the resource (ie :directory)
platform<Symbol,String> | platform name
version<String> | platform version

### Returns

<Chef::Resource> | returns the proper Chef::Resource class

    # File lib/chef/resource.rb, line 858
    def self.resource_for_platform(short_name, platform=nil, version=nil)
      platform_map.get(short_name, platform, version)
    end

state_attrs(*attr_names) click to toggle source

Set or return the list of "state attributes" implemented by the Resource subclass. State attributes are attributes that describe the desired state of the system, such as file permissions or ownership. In general, state attributes are attributes that could be populated by examining the state of the system (e.g., File.stat can tell you the permissions on an existing file). Contrarily, attributes that are not "state attributes" usually modify the way Chef itself behaves, for example by providing additional options for a package manager to use when installing a package.

This list is used by the Chef client auditing system to extract information from resources to describe changes made to the system.

    # File lib/chef/resource.rb, line 159
    def self.state_attrs(*attr_names)
      @state_attrs ||= []
      @state_attrs = attr_names unless attr_names.empty?

      # Return *all* state_attrs that this class has, including inherited ones
      if superclass.respond_to?(:state_attrs)
        superclass.state_attrs + @state_attrs
      else
        @state_attrs
      end
    end

### Public Instance Methods

action(arg=nil) click to toggle source

    # File lib/chef/resource.rb, line 321
    def action(arg=nil)
      if arg
        action_list = arg.kind_of?(Array) ? arg : [ arg ]
        action_list = action_list.collect { |a| a.to_sym }
        action_list.each do |action|
          validate(
            {
              :action => action,
            },
            {
              :action => { :kind_of => Symbol, :equal_to => @allowed_actions },
            }
          )
        end
        @action = action_list
      else
        @action
      end
    end

add_notification(action, resources, timing=:delayed) click to toggle source

    # File lib/chef/resource.rb, line 406
    def add_notification(action, resources, timing=:delayed)
      resources = [resources].flatten
      resources.each do |resource|
        case timing.to_s
        when 'delayed'
          notifies_delayed(action, resource)
        when 'immediate', 'immediately'
          notifies_immediately(action, resource)
        else
          raise ArgumentError,  "invalid timing: #{timing} for notifies(#{action}, #{resources.inspect}, #{timing}) resource #{self} "                                 "Valid timings are: :delayed, :immediate, :immediately"
        end
      end

      true
    end

after_created() click to toggle source

Hook to allow a resource to run specific code after creation

    # File lib/chef/resource.rb, line 703
    def after_created
      nil
    end

as_json(*a) click to toggle source

as_json does most of the to_json heavy lifted. It exists here in case activesupport is loaded. activesupport will call as_json and skip over to_json. This ensure json is encoded as expected

    # File lib/chef/resource.rb, line 503
    def as_json(*a)
      safe_ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS
      instance_vars = Hash.new
      safe_ivars.each do |iv|
        instance_vars[iv.to_s.sub(/^@/, '')] = instance_variable_get(iv)
      end
      results = {
        'json_class' => self.class.name,
        'instance_vars' => instance_vars
      }
    end

cookbook_version() click to toggle source

    # File lib/chef/resource.rb, line 584
    def cookbook_version
      if cookbook_name
        run_context.cookbook_collection[cookbook_name]
      end
    end

customize_exception(e) click to toggle source

    # File lib/chef/resource.rb, line 653
    def customize_exception(e)
      new_exception = e.exception("#{self} (#{defined_at}) had an error: #{e.class.name}: #{e.message}")
      new_exception.set_backtrace(e.backtrace)
      new_exception
    end

defined_at() click to toggle source

    # File lib/chef/resource.rb, line 573
    def defined_at
      if cookbook_name && recipe_name && source_line
        "#{cookbook_name}::#{recipe_name} line #{source_line.split(':')[1]}"
      elsif source_line
        file, line_no = source_line.split(':')
        "#{file} line #{line_no}"
      else
        "dynamically defined"
      end
    end

delayed_notifications() click to toggle source

    # File lib/chef/resource.rb, line 443
    def delayed_notifications
      run_context.delayed_notifications(self)
    end

epic_fail(arg=nil) click to toggle source

    # File lib/chef/resource.rb, line 379
    def epic_fail(arg=nil)
      ignore_failure(arg)
    end

events() click to toggle source

    # File lib/chef/resource.rb, line 590
    def events
      run_context.events
    end

identity() click to toggle source

Returns the value of the identity attribute, if declared. Falls back to name if no identity attribute is declared.

    # File lib/chef/resource.rb, line 249
    def identity
      if identity_attr = self.class.identity_attr
        send(identity_attr)
      else
        name
      end
    end

ignore_failure(arg=nil) click to toggle source

    # File lib/chef/resource.rb, line 355
    def ignore_failure(arg=nil)
      set_or_return(
        :ignore_failure,
        arg,
        :kind_of => [ TrueClass, FalseClass ]
      )
    end

immediate_notifications() click to toggle source

    # File lib/chef/resource.rb, line 439
    def immediate_notifications
      run_context.immediate_notifications(self)
    end

inspect() click to toggle source

    # File lib/chef/resource.rb, line 493
    def inspect
      ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS
      ivars.inject("<#{to_s}") do |str, ivar|
        str << " #{ivar}: #{instance_variable_get(ivar).inspect}"
      end << ">"
    end

is(*args) click to toggle source

    # File lib/chef/resource.rb, line 465
    def is(*args)
      if args.size == 1
        args.first
      else
        return *args
      end
    end

load_prior_resource() click to toggle source

    # File lib/chef/resource.rb, line 281
    def load_prior_resource
      begin
        prior_resource = run_context.resource_collection.lookup(self.to_s)
        # if we get here, there is a prior resource (otherwise we'd have jumped
        # to the rescue clause).
        Chef::Log.warn("Cloning resource attributes for #{self.to_s} from prior resource (CHEF-3694)")
        Chef::Log.warn("Previous #{prior_resource}: #{prior_resource.source_line}") if prior_resource.source_line
        Chef::Log.warn("Current  #{self}: #{self.source_line}") if self.source_line
        prior_resource.instance_variables.each do |iv|
          unless iv.to_sym == :@source_line || iv.to_sym == :@action || iv.to_sym == :@not_if || iv.to_sym == :@only_if
            self.instance_variable_set(iv, prior_resource.instance_variable_get(iv))
          end
        end
        true
      rescue Chef::Exceptions::ResourceNotFound => e
        true
      end
    end

method_missing(method_symbol, *args, &block) click to toggle source

If an unknown method is invoked, determine whether the enclosing Provider's lexical scope can fulfill the request. E.g. This happens when the Resource's block invokes new_resource.

    # File lib/chef/resource.rb, line 273
    def method_missing(method_symbol, *args, &block)
      if enclosing_provider && enclosing_provider.respond_to?(method_symbol)
        enclosing_provider.send(method_symbol, *args, &block)
      else
        raise NoMethodError, "undefined method `#{method_symbol.to_s}' for #{self.class.to_s}"
      end
    end

name(name=nil) click to toggle source

    # File lib/chef/resource.rb, line 341
    def name(name=nil)
      set_if_args(@name, name) do
        raise ArgumentError, "name must be a string!" unless name.kind_of?(String)
        @name = name
      end
    end

node() click to toggle source

    # File lib/chef/resource.rb, line 266
    def node
      run_context && run_context.node
    end

noop(tf=nil) click to toggle source

    # File lib/chef/resource.rb, line 348
    def noop(tf=nil)
      set_if_args(@noop, tf) do
        raise ArgumentError, "noop must be true or false!" unless tf == true || tf == false
        @noop = tf
      end
    end

not_if(command=nil, opts={}, &block) click to toggle source

If command is a block, returns false if the block returns true, true if it returns false. ("Do not run this resource if the block is true")

If the command is not a block, executes the command. If it returns a 0 exitstatus, returns false. ("Do not run this resource if the command returns 0")

### Parameters

command<String> | A a string to execute.
opts<Hash> | Options control the execution of the command
block<Proc> | A ruby block to run. Ignored if a command is given.

### Evaluation

- evaluates to true if the block is false, or if the command returns a non-zero exit status.

- evaluates to false if the block is true, or if the command returns a 0 exit status.

    # File lib/chef/resource.rb, line 566
    def not_if(command=nil, opts={}, &block)
      if command || block_given?
        @not_if << Conditional.not_if(command, opts, &block)
      end
      @not_if
    end

notifies(*args) click to toggle source

    # File lib/chef/resource.rb, line 383
    def notifies(*args)
      unless ( args.size > 0 && args.size < 4)
        raise ArgumentError, "Wrong number of arguments for notifies: should be 1-3 arguments, you gave #{args.inspect}"
      end

      if args.size > 1 # notifies(:action, resource) OR notifies(:action, resource, :immediately)
        add_notification(*args)
      else
        # This syntax is so weird. surely people will just give us one hash?
        notifications = args.flatten
        notifications.each do |resources_notifications|
          resources_notifications.each do |resource, notification|
            action, timing = notification[0], notification[1]
            Chef::Log.debug "Adding notification from resource #{self} to `#{resource.inspect}' => `#{notification.inspect}'"
            add_notification(action, resource, timing)
          end
        end
      end
    rescue NoMethodError
      Chef::Log.fatal("Error processing notifies(#{args.inspect}) on #{self}")
      raise
    end

notifies_delayed(action, resource_spec) click to toggle source

    # File lib/chef/resource.rb, line 435
    def notifies_delayed(action, resource_spec)
      run_context.notifies_delayed(Notification.new(resource_spec, action, self))
    end

notifies_immediately(action, resource_spec) click to toggle source

    # File lib/chef/resource.rb, line 431
    def notifies_immediately(action, resource_spec)
      run_context.notifies_immediately(Notification.new(resource_spec, action, self))
    end

only_if(command=nil, opts={}, &block) click to toggle source

If command is a block, returns true if the block returns true, false if it returns false. ("Only run this resource if the block is true")

If the command is not a block, executes the command. If it returns any status other than 0, it returns false (clearly, a 0 status code is true)

### Parameters

command<String> | A a string to execute.
opts<Hash> | Options control the execution of the command
block<Proc> | A ruby block to run. Ignored if a command is given.

### Evaluation

- evaluates to true if the block is true, or if the command returns 0

- evaluates to false if the block is false, or if the command returns a non-zero exit code.

    # File lib/chef/resource.rb, line 545
    def only_if(command=nil, opts={}, &block)
      if command || block_given?
        @only_if << Conditional.only_if(command, opts, &block)
      end
      @only_if
    end

provider_for_action(action) click to toggle source

    # File lib/chef/resource.rb, line 640
    def provider_for_action(action)
      # leverage new platform => short_name => resource
      # which requires explicitly setting provider in
      # resource class
      if self.provider
        provider = self.provider.new(self, self.run_context)
        provider.action = action
        provider
      else # fall back to old provider resolution
        Chef::Platform.provider_for_resource(self, action)
      end
    end

resolve_notification_references() click to toggle source

Iterates over all immediate and delayed notifications, calling resolve_resource_reference on each in turn, causing them to resolve lazy/forward references.

    # File lib/chef/resource.rb, line 426
    def resolve_notification_references
      run_context.immediate_notifications(self).each { |n| n.resolve_resource_reference(run_context.resource_collection) }
      run_context.delayed_notifications(self).each {|n| n.resolve_resource_reference(run_context.resource_collection) }
    end

resources(*args) click to toggle source

    # File lib/chef/resource.rb, line 447
    def resources(*args)
      run_context.resource_collection.find(*args)
    end

run_action(action, notification_type=nil, notifying_resource=nil) click to toggle source

    # File lib/chef/resource.rb, line 594
    def run_action(action, notification_type=nil, notifying_resource=nil)
      # reset state in case of multiple actions on the same resource.
      @elapsed_time = 0
      start_time = Time.now
      events.resource_action_start(self, action, notification_type, notifying_resource)
      # Try to resolve lazy/forward references in notifications again to handle
      # the case where the resource was defined lazily (ie. in a ruby_block)
      resolve_notification_references
      validate_action(action)

      if Chef::Config[:verbose_logging] || Chef::Log.level == :debug
        # This can be noisy
        Chef::Log.info("Processing #{self} action #{action} (#{defined_at})")
      end

      # ensure that we don't leave @updated_by_last_action set to true
      # on accident
      updated_by_last_action(false)

      begin
        return if should_skip?(action)
        provider_for_action(action).run_action
      rescue Exception => e
        if ignore_failure
          Chef::Log.error("#{self} (#{defined_at}) had an error: #{e.message}; ignore_failure is set, continuing")
          events.resource_failed(self, action, e)
        elsif retries > 0
          events.resource_failed_retriable(self, action, retries, e)
          @retries -= 1
          Chef::Log.info("Retrying execution of #{self}, #{retries} attempt(s) left")
          sleep retry_delay
          retry
        else
          events.resource_failed(self, action, e)
          raise customize_exception(e)
        end
      ensure
        @elapsed_time = Time.now - start_time
        events.resource_completed(self)
      end
    end

should_skip?(action) click to toggle source

Evaluates not_if and only_if conditionals. Returns a falsey value if any of the conditionals indicate that this resource should be skipped, i.e., if an only_if evaluates to false or a not_if evaluates to true.

If this resource should be skipped, returns the first conditional that "fails" its check. Subsequent conditionals are not evaluated, so in general it's not a good idea to rely on side effects from not_if or only_if commands/blocks being evaluated.

    # File lib/chef/resource.rb, line 666
    def should_skip?(action)
      conditionals = only_if + not_if
      return false if conditionals.empty?

      conditionals.find do |conditional|
        if conditional.continue?
          false
        else
          events.resource_skipped(self, action, conditional)
          Chef::Log.debug("Skipping #{self} due to #{conditional.description}")
          true
        end
      end
    end

state() click to toggle source

Returns a Hash of attribute => value for the state attributes declared in the resource's class definition.

    # File lib/chef/resource.rb, line 240
    def state
      self.class.state_attrs.inject({}) do |state_attrs, attr_name|
        state_attrs[attr_name] = send(attr_name)
        state_attrs
      end
    end

subscribes(action, resources, timing=:delayed) click to toggle source

    # File lib/chef/resource.rb, line 451
    def subscribes(action, resources, timing=:delayed)
      resources = [resources].flatten
      resources.each do |resource|
        if resource.is_a?(String)
          resource = Chef::Resource.new(resource, run_context)
        end
        if resource.run_context.nil?
          resource.run_context = run_context
        end
        resource.add_notification(action, self, timing)
      end
      true
    end

supports(args={}) click to toggle source

    # File lib/chef/resource.rb, line 300
    def supports(args={})
      if args.any?
        @supports = args
      else
        @supports
      end
    end

to_hash() click to toggle source

    # File lib/chef/resource.rb, line 521
    def to_hash
      safe_ivars = instance_variables.map { |ivar| ivar.to_sym } - FORBIDDEN_IVARS
      instance_vars = Hash.new
      safe_ivars.each do |iv|
        key = iv.to_s.sub(/^@/,'').to_sym
        instance_vars[key] = instance_variable_get(iv)
      end
      instance_vars
    end

to_json(*a) click to toggle source

Serialize this object as a hash

    # File lib/chef/resource.rb, line 516
    def to_json(*a)
      results = as_json
      results.to_json(*a)
    end

to_s() click to toggle source

    # File lib/chef/resource.rb, line 473
    def to_s
      "#{@resource_name}[#{@name}]"
    end

to_text() click to toggle source

    # File lib/chef/resource.rb, line 477
    def to_text
      ivars = instance_variables.map { |ivar| ivar.to_sym } - HIDDEN_IVARS
      text = "# Declared in #{@source_line}\n\n"
      text << self.class.dsl_name + "(\"#{name}\") do\n"
      ivars.each do |ivar|
        if (value = instance_variable_get(ivar)) && !(value.respond_to?(:empty?) && value.empty?)
          value_string = value.respond_to?(:to_text) ? value.to_text : value.inspect
          text << "  #{ivar.to_s.sub(/^@/,'')} #{value_string}\n"
        end
      end
      [@not_if, @only_if].flatten.each do |conditional|
        text << "  #{conditional.to_text}\n"
      end
      text << "end\n"
    end

updated=(true_or_false) click to toggle source

    # File lib/chef/resource.rb, line 258
    def updated=(true_or_false)
      Chef::Log.warn("Chef::Resource#updated=(true|false) is deprecated. Please call #updated_by_last_action(true|false) instead.")
      Chef::Log.warn("Called from:")
      caller[0..3].each {|line| Chef::Log.warn(line)}
      updated_by_last_action(true_or_false)
      @updated = true_or_false
    end

updated?() click to toggle source

    # File lib/chef/resource.rb, line 690
    def updated?
      updated
    end

updated_by_last_action(true_or_false) click to toggle source

    # File lib/chef/resource.rb, line 681
    def updated_by_last_action(true_or_false)
      @updated ||= true_or_false
      @updated_by_last_action = true_or_false
    end

updated_by_last_action?() click to toggle source

    # File lib/chef/resource.rb, line 686
    def updated_by_last_action?
      @updated_by_last_action
    end

validate_action(action) click to toggle source

    # File lib/chef/resource.rb, line 636
    def validate_action(action)
      raise ArgumentError, "nil is not a valid action for resource #{self}" if action.nil?
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.