File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2828
2929def execute (cmd , fail_ok = False , merge_stderr = False ):
3030 """Executes specified command for the given action."""
31- cmdlist = shlex .split (cmd . encode ( 'utf-8' ) )
31+ cmdlist = shlex .split (cmd )
3232 result = ''
3333 result_err = ''
3434 stdout = subprocess .PIPE
3535 stderr = subprocess .STDOUT if merge_stderr else subprocess .PIPE
3636 proc = subprocess .Popen (cmdlist , stdout = stdout , stderr = stderr )
3737 result , result_err = proc .communicate ()
38+ result = result .decode ('utf-8' )
3839 if not fail_ok and proc .returncode != 0 :
3940 raise exceptions .CommandFailed (proc .returncode , cmd , result ,
4041 result_err )
Original file line number Diff line number Diff line change @@ -32,14 +32,14 @@ class ServerTests(test.TestCase):
3232 def get_flavor (cls ):
3333 raw_output = cls .openstack ('flavor list -f value -c ID' )
3434 ray = raw_output .split ('\n ' )
35- idx = len (ray )/ 2
35+ idx = int ( len (ray )/ 2 )
3636 return ray [idx ]
3737
3838 @classmethod
3939 def get_image (cls ):
4040 raw_output = cls .openstack ('image list -f value -c ID' )
4141 ray = raw_output .split ('\n ' )
42- idx = len (ray )/ 2
42+ idx = int ( len (ray )/ 2 )
4343 return ray [idx ]
4444
4545 @classmethod
@@ -49,7 +49,7 @@ def get_network(cls):
4949 except exceptions .CommandFailed :
5050 return ''
5151 ray = raw_output .split ('\n ' )
52- idx = len (ray )/ 2
52+ idx = int ( len (ray )/ 2 )
5353 return ' --nic net-id=' + ray [idx ]
5454
5555 @classmethod
You can’t perform that action at this time.
0 commit comments