Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sbws
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
juga
sbws
Commits
32f283f7
Commit
32f283f7
authored
6 years ago
by
juga
Browse files
Options
Downloads
Patches
Plain Diff
fix: relaylist: catch exception accessing exit_policy
parent
a9dc014e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sbws/lib/relaylist.py
+16
-2
16 additions, 2 deletions
sbws/lib/relaylist.py
with
16 additions
and
2 deletions
sbws/lib/relaylist.py
+
16
−
2
View file @
32f283f7
...
...
@@ -228,9 +228,23 @@ class Relay:
"""
assert
isinstance
(
port
,
int
)
# if dind't get the descriptor, there isn't exit policy
if
not
self
.
exit_policy
:
# When the attribute is gotten in getattr(self._desc, "exit_policy"),
# is possible that stem's _input_rules is None and raises an exception
# (#29899):
# File "/usr/lib/python3/dist-packages/sbws/lib/relaylist.py", line 117, in can_exit_to_port # noqa
# if not self.exit_policy:
# File "/usr/lib/python3/dist-packages/stem/exit_policy.py", line 512, in __len__ # noqa
# return len(self._get_rules())
# File "/usr/lib/python3/dist-packages/stem/exit_policy.py", line 464, in _get_rules # noqa
# for rule in decompressed_rules:
# TypeError: 'NoneType' object is not iterable
# Therefore, catch the exception here.
try
:
if
self
.
exit_policy
:
return
self
.
exit_policy
.
can_exit_to
(
port
=
port
)
except
TypeError
:
return
False
return
self
.
exit_policy
.
can_exit_to
(
port
=
port
)
return
False
def
is_exit_not_bad_allowing_port
(
self
,
port
):
return
(
Flag
.
BADEXIT
not
in
self
.
flags
and
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment