Skip to content

Commit 1242876

Browse files
committed
Reword error messages to make them more descriptive
1 parent f4b4b08 commit 1242876

File tree

14 files changed

+78
-78
lines changed

14 files changed

+78
-78
lines changed

lib/instance_agent/plugins/codedeploy/application_specification/ace_info.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ def initialize(ace, internal=false)
1212
@name = ""
1313
parts = ace.split(":", -1).reverse
1414
if (parts.length < 2) || (parts.length > 4)
15-
raise AppSpecValidationException, "invalid acl entry #{ace}"
15+
raise AppSpecValidationException, "The deployment failed because of a problem with the acls permission settings in the application specification file. Invalid acl entry (#{ace})."
1616
end
1717

1818
if (parts.length == 4)
1919
if !(parts[3].eql?("d") || (parts[3].eql?("default")))
20-
raise AppSpecValidationException, "invalid acl entry #{ace}"
20+
raise AppSpecValidationException, "The deployment failed because of a problem with the acls permission settings in the application specification file. Invalid acl entry (#{ace})."
2121
end
2222
@default = true
2323
end
2424

2525
if parts.length >= 3
2626
if parts[2].eql?("d") || (parts[2].eql?("default"))
2727
if @default
28-
raise AppSpecValidationException, "invalid acl entry #{ace}"
28+
raise AppSpecValidationException, "The deployment failed because of a problem with the acls permission settings in the application specification file. Invalid acl entry (#{ace})."
2929
end
3030
@default = true
3131
elsif parts[2].eql?("m") || parts[2].eql?("mask")
@@ -37,7 +37,7 @@ def initialize(ace, internal=false)
3737
elsif parts[2].eql?("u") || parts[2].eql?("user")
3838
@type = "user"
3939
else
40-
raise AppSpecValidationException, "invalid acl entry #{ace}"
40+
raise AppSpecValidationException, "The deployment failed because of a problem with the acls permission settings in the application specification file. Invalid acl entry (#{ace})."
4141
end
4242
end
4343

@@ -61,10 +61,10 @@ def initialize(ace, internal=false)
6161
end
6262

6363
if (@type.eql?("mask") || @type.eql?("other")) && !@name.empty?
64-
raise AppSpecValidationException, "invalid acl entry #{ace}"
64+
raise AppSpecValidationException, "The deployment failed because of a problem with the acls permission settings in the application specification file. Invalid acl entry (#{ace})."
6565
end
6666
if (!internal && !@default && !@type.eql?("mask") && @name.empty?)
67-
raise AppSpecValidationException, "use mode to set the base acl entry #{ace}"
67+
raise AppSpecValidationException, "The deployment failed because of a problem with the acls permission settings in the application specification file. Use mode to set the base acl entry (#{ace}). Update the permissions section of the AppSpec file, and then try again."
6868
end
6969

7070
perm_chars = parts[0].chars.entries
@@ -87,7 +87,7 @@ def initialize(ace, internal=false)
8787
@execute = true
8888
when '-'
8989
else
90-
raise AppSpecValidationException, "unrecognized permission character #{perm} in #{ace}"
90+
raise AppSpecValidationException, "The deployment failed because the access control list (ACL) named #{ace} in the application specification file contains an invalid character (#{perm}). Correct the ACL in the hooks section of the AppSpec file, and then try again."
9191
end
9292
end
9393
end
@@ -130,4 +130,4 @@ def to_bits(num, min_size)
130130
end
131131
end
132132
end
133-
end
133+
end

lib/instance_agent/plugins/codedeploy/application_specification/application_specification.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def supported_versions()
2626

2727
def parse_version(version)
2828
if !supported_versions.include?(version)
29-
raise AppSpecValidationException, "unsupported version: #{version}"
29+
raise AppSpecValidationException, "The deployment failed because an invalid version value (#{version}) was entered in the application specification file. Make sure your AppSpec file specifies \"0.0\" as the version, and then try again."
3030
end
3131
version
3232
end
@@ -37,7 +37,7 @@ def supported_oses()
3737

3838
def parse_os(os)
3939
if !supported_oses.include?(os)
40-
raise AppSpecValidationException, "unsupported os: #{os}"
40+
raise AppSpecValidationException, "The deployment failed because the application specification file specifies an unsupported operating system (#{os}). Specify either \"linux\" or \"windows\" in the os section of the AppSpec file, and then try again."
4141
end
4242
os
4343
end
@@ -64,7 +64,7 @@ def parse_hooks(hooks_hash)
6464
:timeout => script['timeout']
6565
})
6666
else
67-
raise AppSpecValidationException, 'script provided without a location value'
67+
raise AppSpecValidationException, 'The deployment failed because the application specification file specifies a script with no location value. Specify the location in the hooks section of the AppSpec file, and then try again.'
6868
end
6969
end
7070
temp_hooks_hash[hook] = current_hook_scripts
@@ -77,7 +77,7 @@ def parse_permissions(permissions_list)
7777
#loop through list and create permissionsInfo representations
7878
permissions_list.each do |permission|
7979
if !permission.has_key?('object') || permission['object'].nil?
80-
raise AppSpecValidationException, 'permission provided without a object value'
80+
raise AppSpecValidationException, 'The deployment failed because a permission listed in the application specification file has no object value. Update the permissions section of the AppSpec file, and then try again.'
8181
end
8282
if @os.eql?('linux')
8383
permissions << InstanceAgent::Plugins::CodeDeployPlugin::ApplicationSpecification::LinuxPermissionInfo.new(permission['object'].to_s.strip,
@@ -92,7 +92,7 @@ def parse_permissions(permissions_list)
9292
:context => parse_context(permission['context'])
9393
})
9494
else
95-
raise AppSpecValidationException, 'permissions only supported with linux os currently'
95+
raise AppSpecValidationException, 'The deployment failed because the application specification file specifiles file permissions, but the deployment is targeting one or more Windows Server instances. Permissions are supported only for Amazon Linux, Ubuntu Server, and Red Hat Enterprise Linux (RHEL) instances. Update the permissions section of the AppSpec file, and then try again.'
9696
end
9797
end
9898
permissions
@@ -119,7 +119,7 @@ def parse_type_list(type_list)
119119
type_list ||= supported_types
120120
type_list.each do |type|
121121
if !supported_types.include?(type)
122-
raise AppSpecValidationException, "assigning permissions to objects of type #{type} not supported"
122+
raise AppSpecValidationException, "The deployment failed because the application specification file specifies a permission for an object type not supported for permissions (#{type}). Update the permissions section of the AppSpec file, and then try again."
123123
end
124124
end
125125
type_list

lib/instance_agent/plugins/codedeploy/application_specification/context_info.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ContextInfo
88
attr_reader :user, :role, :type, :range
99
def initialize(context)
1010
if context['type'].nil?
11-
raise AppSpecValidationException, "invalid context type required #{context.inspect}"
11+
raise AppSpecValidationException, "The deployment failed because the application specification file specifies an invalid context type (#{context.inspect}). Update the permissions section of the AppSpec file, and then try again."
1212
end
1313
@user = context['name']
1414
@role = nil
@@ -20,4 +20,4 @@ def initialize(context)
2020
end
2121
end
2222
end
23-
end
23+
end

lib/instance_agent/plugins/codedeploy/application_specification/file_info.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ class FileInfo
88
attr_reader :source, :destination
99
def initialize(source, destination, opts = {})
1010
if(source.nil?)
11-
raise AppSpecValidationException, 'File needs to have a source'
11+
raise AppSpecValidationException, 'The deployment failed because the application specification file specifies a destination file, but no source file. Update the files section of the AppSpec file, and then try again.'
1212
elsif (destination.nil?)
13-
raise AppSpecValidationException, "File #{source} needs to have a destination"
13+
raise AppSpecValidationException, "The deployment failed because the application specification file specifies only a source file (#{source}). Add the name of the destination file to the files section of the AppSpec file, and then try again."
1414
end
1515
@source = source
1616
@destination = destination

lib/instance_agent/plugins/codedeploy/application_specification/linux_permission_info.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class LinuxPermissionInfo
99
def initialize(object, opts = {})
1010
object = object.to_s
1111
if (object.empty?)
12-
raise AppSpecValidationException, 'Permission needs a object value'
12+
raise AppSpecValidationException, 'The deployment failed because a permission listed in the application specification file has no object value. Update the permissions section of the AppSpec file, and then try again.'
1313
end
1414
@object = object
1515
@pattern = opts[:pattern] || "**"
@@ -25,10 +25,10 @@ def initialize(object, opts = {})
2525
def validate_file_permission()
2626
if @type.include?("file")
2727
if !"**".eql?(@pattern)
28-
raise AppSpecValidationException, "Attempt to use pattern #{@pattern} when assigning permissions to file #{@object}"
28+
raise AppSpecValidationException, "The deployment failed because the application specification file includes an object (#{@object}) with an invalid pattern (#{@pattern}), such as a pattern for a file applied to a directory. Correct the permissions section of the AppSpec file, and then try again."
2929
end
3030
if !@except.empty?
31-
raise AppSpecValidationException, "Attempt to use except #{@except} when assigning permissions to file #{@object}"
31+
raise AppSpecValidationException, "The deployment failed because the except parameter for a pattern in the permissions section (#{@except}) for the object named #{@object} contains an invalid format. Update the AppSpec file, and then try again."
3232
end
3333
end
3434
end
@@ -37,7 +37,7 @@ def validate_file_acl(object)
3737
if !@acls.nil?
3838
default_acl = @acls.get_default_ace
3939
if !default_acl.nil?
40-
raise "Attempt to set default acl #{default_acl} on file #{object}"
40+
raise "The deployment failed because the -d parameter has been specified to apply an acl setting to a file. This parameter is supported for directories only. Update the AppSpec file, and then try again."
4141
end
4242
end
4343
end
@@ -118,4 +118,4 @@ def sanitize_dir_path(path)
118118
end
119119
end
120120
end
121-
end
121+
end

lib/instance_agent/plugins/codedeploy/application_specification/mode_info.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ def initialize(mode)
1616
mode = "0" + mode;
1717
end
1818
if mode.length > 4
19-
raise AppSpecValidationException, "permission mode length incorrect: #{mode}"
19+
raise AppSpecValidationException, "The deployment failed because the length of a permissions mode (#{mode}) in the application specification file is invalid. Permissions modes must be between one and four characters long. Update the permissions section of the AppSpec file, and then try again."
2020
end
2121
mode.each_char do |char|
2222
if (char.ord < '0'.ord) || (char.ord > '7'.ord)
23-
raise AppSpecValidationException, "invalid character #{char} in permission mode #{mode}"
23+
raise AppSpecValidationException, "The deployment failed because the permissions mode (#{mode}) in the application specification file contains an invalid character (#{char}). Update the permissions section of the AppSpec file, and then try again."
2424
end
2525
end
2626
@mode = mode
@@ -63,4 +63,4 @@ def to_bits(num, min_size)
6363
end
6464
end
6565
end
66-
end
66+
end

lib/instance_agent/plugins/codedeploy/application_specification/range_info.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def initialize(range)
1313
if sensitivity_parts.length == 2
1414
@high_sensitivity = getSensitivityNumber(sensitivity_parts[1])
1515
if @high_sensitivity < @low_sensitivity
16-
raise AppSpecValidationException, "invalid sensitivity range in #{range}"
16+
raise AppSpecValidationException, "The deployment failed because of a problem with the SELinux range specified (#{range}) for the context parameter in the permissions section of the application specification file. Make corrections in the permissions section of the AppSpec file, and then try again."
1717
end
1818
else
1919
@high_sensitivity = @low_sensitivity
@@ -131,4 +131,4 @@ def get_range
131131
end
132132
end
133133
end
134-
end
134+
end

lib/instance_agent/plugins/codedeploy/application_specification/script_info.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ class ScriptInfo
99
def initialize(location, opts = {})
1010
location = location.to_s
1111
if(location.empty?)
12-
raise AppSpecValidationException, 'Scripts need a location value'
12+
raise AppSpecValidationException, 'The deployment failed because the application specification file specifies a script with no location value. Specify the location in the hooks section of the AppSpec file, and then try again.'
1313
end
1414
@location = location
1515
@runas = opts[:runas]
1616
@sudo = opts[:sudo]
1717
@timeout = opts[:timeout] || 3600
1818
@timeout = @timeout.to_i
1919
if(@timeout <= 0)
20-
raise AppSpecValidationException, 'Timeout needs to be an integer greater than 0'
20+
raise AppSpecValidationException, 'The deployment failed because an invalid timeout value was provided for a script in the application specification file. Make corrections in the hooks section of the AppSpec file, and then try again.'
2121
end
2222
end
2323
end

0 commit comments

Comments
 (0)