Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
ffb281d9
Commit
ffb281d9
authored
Mar 03, 2015
by
Toshio Kuratomi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9600 from msabramo/make_AnsibleError_a_plain_ol_exception
Make AnsibleError a plain ol' exception
parents
4f5ca4bb
372a2974
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
13 deletions
+8
-13
lib/ansible/errors.py
+1
-6
test/units/TestUtils.py
+7
-7
No files found.
lib/ansible/errors.py
View file @
ffb281d9
...
@@ -17,12 +17,7 @@
...
@@ -17,12 +17,7 @@
class
AnsibleError
(
Exception
):
class
AnsibleError
(
Exception
):
''' The base Ansible exception from which all others should subclass '''
''' The base Ansible exception from which all others should subclass '''
pass
def
__init__
(
self
,
msg
):
self
.
msg
=
msg
def
__str__
(
self
):
return
self
.
msg
class
AnsibleFileNotFound
(
AnsibleError
):
class
AnsibleFileNotFound
(
AnsibleError
):
pass
pass
...
...
test/units/TestUtils.py
View file @
ffb281d9
...
@@ -293,7 +293,7 @@ class TestUtils(unittest.TestCase):
...
@@ -293,7 +293,7 @@ class TestUtils(unittest.TestCase):
try
:
try
:
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
__file__
)
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
__file__
)
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
self
.
assertTrue
(
'Syntax Error while loading'
in
e
.
msg
)
self
.
assertTrue
(
'Syntax Error while loading'
in
str
(
e
)
)
else
:
else
:
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
...
@@ -304,7 +304,7 @@ class TestUtils(unittest.TestCase):
...
@@ -304,7 +304,7 @@ class TestUtils(unittest.TestCase):
try
:
try
:
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
__file__
)
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
__file__
)
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
self
.
assertTrue
(
'Syntax Error while loading'
in
e
.
msg
)
self
.
assertTrue
(
'Syntax Error while loading'
in
str
(
e
)
)
else
:
else
:
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
...
@@ -315,7 +315,7 @@ class TestUtils(unittest.TestCase):
...
@@ -315,7 +315,7 @@ class TestUtils(unittest.TestCase):
try
:
try
:
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
__file__
)
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
__file__
)
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
self
.
assertTrue
(
'Check over'
in
e
.
msg
)
self
.
assertTrue
(
'Check over'
in
str
(
e
)
)
else
:
else
:
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
...
@@ -326,7 +326,7 @@ class TestUtils(unittest.TestCase):
...
@@ -326,7 +326,7 @@ class TestUtils(unittest.TestCase):
try
:
try
:
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
None
)
ansible
.
utils
.
process_yaml_error
(
exc
,
data
,
None
)
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
self
.
assertTrue
(
'Could not parse YAML.'
in
e
.
msg
)
self
.
assertTrue
(
'Could not parse YAML.'
in
str
(
e
)
)
else
:
else
:
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
...
@@ -352,7 +352,7 @@ class TestUtils(unittest.TestCase):
...
@@ -352,7 +352,7 @@ class TestUtils(unittest.TestCase):
try
:
try
:
ansible
.
utils
.
parse_yaml_from_file
(
broken
)
ansible
.
utils
.
parse_yaml_from_file
(
broken
)
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
except
ansible
.
errors
.
AnsibleYAMLValidationFailed
,
e
:
self
.
assertTrue
(
'Syntax Error while loading'
in
e
.
msg
)
self
.
assertTrue
(
'Syntax Error while loading'
in
str
(
e
)
)
else
:
else
:
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
raise
AssertionError
(
'Incorrect exception, expected AnsibleYAMLValidationFailed'
)
...
@@ -594,8 +594,8 @@ class TestUtils(unittest.TestCase):
...
@@ -594,8 +594,8 @@ class TestUtils(unittest.TestCase):
try
:
try
:
ansible
.
utils
.
deprecated
(
'Ack!'
,
'0.0'
,
True
)
ansible
.
utils
.
deprecated
(
'Ack!'
,
'0.0'
,
True
)
except
ansible
.
errors
.
AnsibleError
,
e
:
except
ansible
.
errors
.
AnsibleError
,
e
:
self
.
assertTrue
(
'0.0'
not
in
e
.
msg
)
self
.
assertTrue
(
'0.0'
not
in
str
(
e
)
)
self
.
assertTrue
(
'[DEPRECATED]'
in
e
.
msg
)
self
.
assertTrue
(
'[DEPRECATED]'
in
str
(
e
)
)
else
:
else
:
raise
AssertionError
(
"Incorrect exception, expected AnsibleError"
)
raise
AssertionError
(
"Incorrect exception, expected AnsibleError"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment