Summary: drop use of str() on exception messages
Description: - Oracle-Bug: 21810245 - drop use of strings on exception messages. When messages are in > 128 unicode, str() will throw an exception.
This commit is contained in:
parent
987b8fa2c5
commit
1079c0fa4c
@ -125,7 +125,7 @@ class Host(object):
|
||||
except Exception as e:
|
||||
raise exceptions.CommandError(
|
||||
'ERROR: Host (%s) setup failed : %s'
|
||||
% (self.name, str(e)))
|
||||
% (self.name, e))
|
||||
return True
|
||||
|
||||
def check(self):
|
||||
@ -140,11 +140,12 @@ class Host(object):
|
||||
if err_flag:
|
||||
raise exceptions.CommandError(
|
||||
'ERROR: Host (%s) check failed : %s'
|
||||
% (self.name, str(output)))
|
||||
% (self.name, output))
|
||||
else:
|
||||
self.log.info('Host (%s) check succeeded' % self.name)
|
||||
return True
|
||||
|
||||
|
||||
class HostGroup(object):
|
||||
class_version = 1
|
||||
|
||||
@ -292,7 +293,7 @@ class Inventory(object):
|
||||
shutil.copyfile(tmp_path, inventory_path)
|
||||
os.remove(tmp_path)
|
||||
except Exception as e:
|
||||
raise Exception('ERROR: saving inventory : %s' % str(e))
|
||||
raise Exception('ERROR: saving inventory : %s' % e)
|
||||
finally:
|
||||
try:
|
||||
os.close(tmp_filehandle)
|
||||
|
@ -100,14 +100,14 @@ def _post_setup_checks(net_addr, log):
|
||||
ssh_client = ssh_connect(net_addr, get_admin_user(), '')
|
||||
|
||||
except Exception as e:
|
||||
raise CommandError("ERROR: remote login failed : %s" % str(e))
|
||||
raise CommandError("ERROR: remote login failed : %s" % e)
|
||||
|
||||
try:
|
||||
# a basic test
|
||||
ssh_client.exec_command('ls')
|
||||
|
||||
except Exception as e:
|
||||
raise CommandError("ERROR: remote command 'ls' failed : %s" % str(e))
|
||||
raise CommandError("ERROR: remote command 'ls' failed : %s" % e)
|
||||
|
||||
finally:
|
||||
_close_ssh_client(ssh_client)
|
||||
|
@ -13,9 +13,8 @@
|
||||
# under the License.
|
||||
import logging
|
||||
import os
|
||||
import yaml
|
||||
import pexpect
|
||||
import string
|
||||
import yaml
|
||||
|
||||
|
||||
def get_kolla_home():
|
||||
|
Loading…
Reference in New Issue
Block a user