-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix logging issues #108
Fix logging issues #108
Changes from all commits
254bfe8
2ca0c16
2e2000f
259999d
6de4aee
2607202
00aac29
114031f
97f8ad0
99c3d47
5a16313
8ad1e8e
af9f61b
690ba3c
f484158
2724e6f
609c096
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[run] | ||
branch = True | ||
timid = True | ||
|
||
[report] | ||
exclude_lines = | ||
pragma: no cover | ||
pragma: py3 no cover | ||
if six.PY2 | ||
elif six.PY2 | ||
|
||
partial_branches = | ||
pragma: no cover | ||
pragma: py3 no cover | ||
if six.PY3 | ||
elif six.PY3 | ||
|
||
show_missing = True | ||
|
||
fail_under = 90 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.idea | ||
.vscode | ||
.cache/ | ||
build/ | ||
dist/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
3.9.3.dev0 | ||
4.0.0 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,21 +30,39 @@ class _CalledProcessError(ClientError): | |
cmd, return_code, output | ||
""" | ||
|
||
def __init__(self, cmd, return_code=None, output=None): | ||
self.return_code = return_code | ||
def __init__(self, cmd, return_code=None, output=None, info=None): | ||
self.return_code = str(return_code) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
self.cmd = cmd | ||
self.output = output | ||
self.extra_info = info | ||
super(_CalledProcessError, self).__init__() | ||
|
||
def __str__(self): | ||
if six.PY3 and self.output: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we remove the PY3 check, since PY2 is deprecated ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for catching these. Removed PY2 related in the following commit |
||
error_msg = "\n%s" % self.output.decode("latin1") | ||
# error_msg = "%s" % self.output.decode("latin1") | ||
if isinstance(self.output, bytes): | ||
error_msg = "%s" % self.output.decode("utf-8") | ||
else: | ||
error_msg = "%s" % self.output | ||
elif self.output: | ||
error_msg = "\n%s" % self.output | ||
error_msg = "%s" % self.output | ||
else: | ||
error_msg = "" | ||
|
||
message = '%s:\nCommand "%s"%s' % (type(self).__name__, self.cmd, error_msg) | ||
if self.extra_info is None: | ||
message = '%s:\nExitCode %s\nErrorMessage "%s"\nCommand "%s"' % ( | ||
type(self).__name__, | ||
self.return_code, | ||
error_msg, | ||
self.cmd, | ||
) | ||
else: | ||
message = '%s:\nExitCode %s\nErrorMessage "%s"\nExtraInfo "%s"\nCommand "%s"' % ( | ||
type(self).__name__, | ||
self.return_code, | ||
error_msg, | ||
self.extra_info, | ||
self.cmd, | ||
) | ||
return message.strip() | ||
|
||
|
||
|
@@ -64,11 +82,11 @@ class ExecuteUserScriptError(_CalledProcessError): | |
"""Error class indicating a user script failed to execute.""" | ||
|
||
|
||
class ChannelDoesNotExistException(Exception): | ||
class ChannelDoesNotExistError(Exception): | ||
"""Error class indicating a channel does not exist.""" | ||
|
||
def __init__(self, channel_name): | ||
super(ChannelDoesNotExistException, self).__init__( | ||
super(ChannelDoesNotExistError, self).__init__( | ||
"Channel %s is not a valid channel" % channel_name | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we planning not to update py36 containers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. This is because of
asyncio.run
which is available from Py3.7. There are other ways to achieve this using asyncio in py3.6 but it is too low level and handling them is very difficult.