Fixed style according to reviewer and a refactoring error
I had to create this CL due to comitting before the final comments in the last CL http://review.webrtc.org/1157005/ in revision: https://code.google.com/p/webrtc/source/detail?r=3642 Changed e.msg to e.fail_msg in logging.error in emulate.py Added space to error message for windows in check_permissions() in network_emulator BUG=none TEST=Windows and linux Review URL: https://webrtc-codereview.appspot.com/1167006 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3646 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
db8ca9a395
commit
0ef22c24c0
@ -154,7 +154,7 @@ def _main():
|
|||||||
try:
|
try:
|
||||||
emulator.check_permissions()
|
emulator.check_permissions()
|
||||||
except network_emulator.NetworkEmulatorError as e:
|
except network_emulator.NetworkEmulatorError as e:
|
||||||
logging.error('Error: %s\n\nCause: %s', e.msg, e.error)
|
logging.error('Error: %s\n\nCause: %s', e.fail_msg, e.error)
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
if not options.target_ip:
|
if not options.target_ip:
|
||||||
@ -186,7 +186,7 @@ def _main():
|
|||||||
logging.info('Completed Network Emulation.')
|
logging.info('Completed Network Emulation.')
|
||||||
return 0
|
return 0
|
||||||
except network_emulator.NetworkEmulatorError as e:
|
except network_emulator.NetworkEmulatorError as e:
|
||||||
logging.error('Error: %s\n\nCause: %s', e.msg, e.error)
|
logging.error('Error: %s\n\nCause: %s', e.fail_msg, e.error)
|
||||||
return -2
|
return -2
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -97,7 +97,7 @@ class NetworkEmulator(object):
|
|||||||
# AttributeError will be raised on Windows.
|
# AttributeError will be raised on Windows.
|
||||||
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
|
if ctypes.windll.shell32.IsUserAnAdmin() == 0:
|
||||||
raise NetworkEmulatorError('You must run this script with administrator'
|
raise NetworkEmulatorError('You must run this script with administrator'
|
||||||
'privileges.')
|
' privileges.')
|
||||||
|
|
||||||
def _create_dummynet_rule(self, pipe_id, from_address, to_address,
|
def _create_dummynet_rule(self, pipe_id, from_address, to_address,
|
||||||
port_range):
|
port_range):
|
||||||
@ -169,7 +169,7 @@ def _run_ipfw_command(command, fail_msg=None):
|
|||||||
fail_msg: Message describing the error in case the command fails.
|
fail_msg: Message describing the error in case the command fails.
|
||||||
|
|
||||||
Raises:
|
Raises:
|
||||||
NetworkEmulatorError: If command fails. Message is set by the fail_msg
|
NetworkEmulatorError: If command fails a message is set by the fail_msg
|
||||||
parameter.
|
parameter.
|
||||||
"""
|
"""
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user