summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/cookbook_manifest.rb1
-rw-r--r--lib/chef/encrypted_data_bag_item/assertions.rb2
-rw-r--r--lib/chef/event_loggers/base.rb1
-rw-r--r--lib/chef/exceptions.rb100
-rw-r--r--lib/chef/provider/git.rb10
-rw-r--r--lib/chef/provider/package/yum/rpm_utils.rb1
-rw-r--r--lib/chef/resource/template.rb4
-rw-r--r--lib/chef/resource_collection/resource_set.rb2
-rw-r--r--lib/chef/win32/api/file.rb4
9 files changed, 116 insertions, 9 deletions
diff --git a/lib/chef/cookbook_manifest.rb b/lib/chef/cookbook_manifest.rb
index 6e79a880e9..84b0c0d58c 100644
--- a/lib/chef/cookbook_manifest.rb
+++ b/lib/chef/cookbook_manifest.rb
@@ -317,6 +317,7 @@ class Chef
end
end
+
class CookbookManifestVersions
extend Chef::Mixin::VersionedAPIFactory
diff --git a/lib/chef/encrypted_data_bag_item/assertions.rb b/lib/chef/encrypted_data_bag_item/assertions.rb
index 02baad2a2d..13ed0de050 100644
--- a/lib/chef/encrypted_data_bag_item/assertions.rb
+++ b/lib/chef/encrypted_data_bag_item/assertions.rb
@@ -30,7 +30,7 @@ class Chef::EncryptedDataBagItem
unless format_version.is_a?(Integer) && format_version >= Chef::Config[:data_bag_decrypt_minimum_version]
raise UnacceptableEncryptedDataBagItemFormat,
"The encrypted data bag item has format version `#{format_version}', " +
- "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'"
+ "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'"
end
end
diff --git a/lib/chef/event_loggers/base.rb b/lib/chef/event_loggers/base.rb
index 1ef7f7de6c..ad403e4230 100644
--- a/lib/chef/event_loggers/base.rb
+++ b/lib/chef/event_loggers/base.rb
@@ -21,6 +21,7 @@ require_relative "../event_dispatch/base"
class Chef
module EventLoggers
class UnknownEventLogger < StandardError; end
+
class UnavailableEventLogger < StandardError; end
def self.event_loggers_by_name
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index e0b534c3d3..7f36f8d674 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -44,21 +44,37 @@ class Chef
end
class Application < RuntimeError; end
+
class SigInt < RuntimeError; end
+
class SigTerm < RuntimeError; end
+
class Cron < RuntimeError; end
+
class WindowsEnv < RuntimeError; end
+
class Exec < RuntimeError; end
+
class Execute < RuntimeError; end
+
class ErlCall < RuntimeError; end
+
class FileNotFound < RuntimeError; end
+
class Package < RuntimeError; end
+
class Service < RuntimeError; end
+
class Script < RuntimeError; end
+
class Route < RuntimeError; end
+
class SearchIndex < RuntimeError; end
+
class Override < RuntimeError; end
+
class UnsupportedAction < RuntimeError; end
+
class MissingLibrary < RuntimeError; end
class CannotDetermineNodeName < RuntimeError
@@ -68,64 +84,112 @@ class Chef
end
class User < RuntimeError; end
+
class Group < RuntimeError; end
+
class Link < RuntimeError; end
+
class Mount < RuntimeError; end
+
class Reboot < Exception; end # rubocop:disable Lint/InheritException
+
class RebootPending < Exception; end # rubocop:disable Lint/InheritException
+
class RebootFailed < Mixlib::ShellOut::ShellCommandFailed; end
+
class ClientUpgraded < Exception; end # rubocop:disable Lint/InheritException
+
class PrivateKeyMissing < RuntimeError; end
+
class CannotWritePrivateKey < RuntimeError; end
+
class RoleNotFound < RuntimeError; end
+
class DuplicateRole < RuntimeError; end
+
class ValidationFailed < ArgumentError; end
+
class CannotValidateStaticallyError < ArgumentError; end
+
class InvalidPrivateKey < ArgumentError; end
+
class MissingKeyAttribute < ArgumentError; end
+
class KeyCommandInputError < ArgumentError; end
+
class BootstrapCommandInputError < ArgumentError
def initialize
super "You cannot pass both --json-attributes and --json-attribute-file. Please pass one or none."
end
end
+
class InvalidKeyArgument < ArgumentError; end
+
class InvalidKeyAttribute < ArgumentError; end
+
class InvalidUserAttribute < ArgumentError; end
+
class InvalidClientAttribute < ArgumentError; end
+
class RedirectLimitExceeded < RuntimeError; end
+
class AmbiguousRunlistSpecification < ArgumentError; end
+
class CookbookFrozen < ArgumentError; end
+
class CookbookNotFound < RuntimeError; end
+
class OnlyApiVersion0SupportedForAction < RuntimeError; end
+
# Cookbook loader used to raise an argument error when cookbook not found.
# for back compat, need to raise an error that inherits from ArgumentError
class CookbookNotFoundInRepo < ArgumentError; end
+
class CookbookMergingError < RuntimeError; end
+
class RecipeNotFound < ArgumentError; end
+
# AttributeNotFound really means the attribute file could not be found
class AttributeNotFound < RuntimeError; end
+
# NoSuchAttribute is raised on access by node.read!("foo", "bar") when node["foo"]["bar"] does not exist.
class NoSuchAttribute < RuntimeError; end
+
# AttributeTypeMismatch is raised by node.write!("foo", "bar", "baz") when e.g. node["foo"] = "bar" (overwriting String with Hash)
class AttributeTypeMismatch < RuntimeError; end
+
class MissingCookbookDependency < StandardError; end # CHEF-5120
+
class InvalidCommandOption < RuntimeError; end
+
class CommandTimeout < RuntimeError; end
+
class RequestedUIDUnavailable < RuntimeError; end
+
class InvalidHomeDirectory < ArgumentError; end
+
class DsclCommandFailed < RuntimeError; end
+
class PlistUtilCommandFailed < RuntimeError; end
+
class UserIDNotFound < ArgumentError; end
+
class GroupIDNotFound < ArgumentError; end
+
class ConflictingMembersInGroup < ArgumentError; end
+
class InvalidResourceReference < RuntimeError; end
+
class ResourceNotFound < RuntimeError; end
+
class ProviderNotFound < RuntimeError; end
NoProviderAvailable = ProviderNotFound
class VerificationNotFound < RuntimeError; end
+
class InvalidEventType < ArgumentError; end
+
class MultipleIdentityError < RuntimeError; end
+
# Used in Resource::ActionClass#load_current_resource to denote that
# the resource doesn't actually exist (for example, the file does not exist)
class CurrentValueDoesNotExist < RuntimeError; end
@@ -140,36 +204,56 @@ class Chef
class InvalidPolicybuilderCall < ArgumentError; end
class InvalidResourceSpecification < ArgumentError; end
+
class SolrConnectionError < RuntimeError; end
+
class IllegalChecksumRevert < RuntimeError; end
+
class CookbookVersionNameMismatch < ArgumentError; end
+
class MissingParentDirectory < RuntimeError; end
+
class UnresolvableGitReference < RuntimeError; end
+
class InvalidRemoteGitReference < RuntimeError; end
+
class InvalidEnvironmentRunListSpecification < ArgumentError; end
+
class InvalidDataBagItemID < ArgumentError; end
+
class InvalidDataBagName < ArgumentError; end
+
class EnclosingDirectoryDoesNotExist < ArgumentError; end
+
# Errors originating from calls to the Win32 API
class Win32APIError < RuntimeError; end
# Thrown when Win32 API layer binds to non-existent Win32 function. Occurs
# when older versions of Windows don't support newer Win32 API functions.
class Win32APIFunctionNotImplemented < NotImplementedError; end # rubocop:disable Lint/InheritException
+
# Attempting to run windows code on a not-windows node
class Win32NotWindows < RuntimeError; end
+
class WindowsNotAdmin < RuntimeError; end
+
# Attempting to access a 64-bit only resource on a 32-bit Windows system
class Win32ArchitectureIncorrect < RuntimeError; end
+
class ObsoleteDependencySyntax < ArgumentError; end
+
class InvalidDataBagPath < ArgumentError; end
+
class DuplicateDataBagItem < RuntimeError; end
class PowershellCmdletException < RuntimeError; end
+
class LCMParser < RuntimeError; end
class CannotDetermineHomebrewOwner < Package; end
+
class CannotDetermineWindowsInstallerType < Package; end
+
class NoWindowsPackageSource < Package; end
# Can not create staging file during file deployment
@@ -185,6 +269,7 @@ class Chef
# does not follow X.Y.Z format. ArgumentError?
class InvalidPlatformVersion < ArgumentError; end
+
class InvalidCookbookVersion < ArgumentError; end
# version constraint should be a string or array, or it doesn't
@@ -195,6 +280,7 @@ class Chef
class IllegalVersionConstraint < NotImplementedError; end # rubocop:disable Lint/InheritException
class MetadataNotValid < StandardError; end
+
class MetadataNotFound < StandardError
attr_reader :install_path
attr_reader :cookbook_name
@@ -232,22 +318,34 @@ class Chef
# Registry Helper throws the following errors
class Win32RegArchitectureIncorrect < Win32ArchitectureIncorrect; end
+
class Win32RegHiveMissing < ArgumentError; end
+
class Win32RegKeyMissing < RuntimeError; end
+
class Win32RegValueMissing < RuntimeError; end
+
class Win32RegDataMissing < RuntimeError; end
+
class Win32RegValueExists < RuntimeError; end
+
class Win32RegNoRecursive < ArgumentError; end
+
class Win32RegTypeDoesNotExist < ArgumentError; end
+
class Win32RegBadType < ArgumentError; end
+
class Win32RegBadValueSize < ArgumentError; end
+
class Win32RegTypesMismatch < ArgumentError; end
# incorrect input for registry_key create action throws following error
class RegKeyValuesTypeMissing < ArgumentError; end
+
class RegKeyValuesDataMissing < ArgumentError; end
class InvalidEnvironmentPath < ArgumentError; end
+
class EnvironmentNotFound < RuntimeError; end
# File-like resource found a non-file (socket, pipe, directory, etc) at its destination
@@ -283,6 +381,7 @@ class Chef
end
end
+
# Exception class for collecting multiple failures. Used when running
# delayed notifications so that chef can process each delayed
# notification even if chef client or other notifications fail.
@@ -432,6 +531,7 @@ class Chef
# Raised by Chef::JSONCompat
class JSON
class EncodeError < RuntimeError; end
+
class ParseError < RuntimeError; end
end
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index f1c8380307..c0f6f01c59 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -68,9 +68,9 @@ class Chef
a.assertion { !(new_resource.revision =~ %r{^origin/}) }
a.failure_message Chef::Exceptions::InvalidRemoteGitReference,
"Deploying remote branches is not supported. " +
- "Specify the remote branch as a local branch for " +
- "the git repository you're deploying from " +
- "(ie: '#{new_resource.revision.gsub("origin/", "")}' rather than '#{new_resource.revision}')."
+ "Specify the remote branch as a local branch for " +
+ "the git repository you're deploying from " +
+ "(ie: '#{new_resource.revision.gsub("origin/", "")}' rather than '#{new_resource.revision}')."
end
requirements.assert(:all_actions) do |a|
@@ -80,8 +80,8 @@ class Chef
a.assertion { !target_revision.nil? }
a.failure_message Chef::Exceptions::UnresolvableGitReference,
"Unable to parse SHA reference for '#{new_resource.revision}' in repository '#{new_resource.repository}'. " +
- "Verify your (case-sensitive) repository URL and revision.\n" +
- "`git ls-remote '#{new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}"
+ "Verify your (case-sensitive) repository URL and revision.\n" +
+ "`git ls-remote '#{new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}"
end
end
diff --git a/lib/chef/provider/package/yum/rpm_utils.rb b/lib/chef/provider/package/yum/rpm_utils.rb
index 7514d57bce..2932fc97dd 100644
--- a/lib/chef/provider/package/yum/rpm_utils.rb
+++ b/lib/chef/provider/package/yum/rpm_utils.rb
@@ -485,6 +485,7 @@ class Chef
end
class RPMProvide < RPMDependency; end
+
class RPMRequire < RPMDependency; end
class RPMDbPackage < RPMPackage
diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb
index 88fde45a25..e3f266740d 100644
--- a/lib/chef/resource/template.rb
+++ b/lib/chef/resource/template.rb
@@ -169,8 +169,8 @@ class Chef
elsif module_name.nil?
raise Exceptions::ValidationFailed,
"#helpers requires either a module name or inline module code as a block.\n" +
- "e.g.: helpers do; helper_code; end;\n" +
- "OR: helpers(MyHelpersModule)"
+ "e.g.: helpers do; helper_code; end;\n" +
+ "OR: helpers(MyHelpersModule)"
else
raise Exceptions::ValidationFailed,
"Argument to #helpers must be a module. You gave #{module_name.inspect} (#{module_name.class})"
diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb
index db298afb63..26521010bd 100644
--- a/lib/chef/resource_collection/resource_set.rb
+++ b/lib/chef/resource_collection/resource_set.rb
@@ -131,7 +131,7 @@ class Chef
else
raise Chef::Exceptions::InvalidResourceSpecification,
"The object `#{query_object.inspect}' is not valid for resource collection lookup. " +
- "Use a String like `resource_type[resource_name]' or a Chef::Resource object"
+ "Use a String like `resource_type[resource_name]' or a Chef::Resource object"
end
end
diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb
index eb83e2487d..c18bc08e8b 100644
--- a/lib/chef/win32/api/file.rb
+++ b/lib/chef/win32/api/file.rb
@@ -316,6 +316,7 @@ typedef struct _REPARSE_DATA_BUFFER {
string_pointer.read_wstring(self[:PrintNameLength] / 2)
end
end
+
class REPARSE_DATA_BUFFER_MOUNT_POINT < FFI::Struct
layout :SubstituteNameOffset, :ushort,
:SubstituteNameLength, :ushort,
@@ -333,14 +334,17 @@ typedef struct _REPARSE_DATA_BUFFER {
string_pointer.read_wstring(self[:PrintNameLength] / 2)
end
end
+
class REPARSE_DATA_BUFFER_GENERIC < FFI::Struct
layout :DataBuffer, :uchar
end
+
class REPARSE_DATA_BUFFER_UNION < FFI::Union
layout :SymbolicLinkReparseBuffer, REPARSE_DATA_BUFFER_SYMBOLIC_LINK,
:MountPointReparseBuffer, REPARSE_DATA_BUFFER_MOUNT_POINT,
:GenericReparseBuffer, REPARSE_DATA_BUFFER_GENERIC
end
+
class REPARSE_DATA_BUFFER < FFI::Struct
layout :ReparseTag, :uint32,
:ReparseDataLength, :ushort,