From 8d4ba82ac3a598992ee3d8fbe7ea14375b7c0801 Mon Sep 17 00:00:00 2001 From: Vincenzo Maffione Date: Sat, 8 Apr 2017 12:55:15 +0200 Subject: testbeds: qemu: use % for formatting strings --- rumba/testbeds/qemu.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rumba/testbeds/qemu.py b/rumba/testbeds/qemu.py index 897af37..1830b37 100644 --- a/rumba/testbeds/qemu.py +++ b/rumba/testbeds/qemu.py @@ -57,7 +57,7 @@ class Testbed(mod.Testbed): for command in commands: if not error_queue.empty(): break - print('DEBUG: executing >> {}'.format(command)) + print('DEBUG: executing >> %s' % command) subprocess.check_call(command.split()) results_queue.put("Command chain ran correctly.") @@ -70,7 +70,7 @@ class Testbed(mod.Testbed): :param experiment: The experiment running """ if os.geteuid() != 0: - pw = getpass.getpass('[sudo] password for {}:'.format(getpass.getuser())) + pw = getpass.getpass('[sudo] password for %s:' % getpass.getuser()) if '"' in pw or "'" in pw: print('Illegal password: contains " or \'') raise Exception('Not authenticated') @@ -142,8 +142,8 @@ class Testbed(mod.Testbed): # Check for errors if not e_queue.empty(): error_str = str(e_queue.get()) - print('Testbed instantiation failed: {}'.format(error_str)) - raise Exception('Failure: {}'.format(error_str)) + print('Testbed instantiation failed: %s' % error_str) + raise Exception('Failure: %s' % error_str) try: # Check for results result = r_queue.get(timeout=1) @@ -218,12 +218,12 @@ class Testbed(mod.Testbed): booting_budget -= 1 if booting_budget <= 0: - print('Sleeping for {} seconds to give the machines time to boot up.'.format(boot_backoff)) + print('Sleeping for %s seconds to give the machines time to boot up.' % boot_backoff) time.sleep(boot_backoff) booting_budget = boot_batch_size with open('%s/qemu_out_%s' % (self.qemu_logs_dir, vmid), 'w') as out_file: - print('DEBUG: executing >> {}'.format(command)) + print('DEBUG: executing >> %s' % command) self.boot_processes.append(subprocess.Popen(command.split(), stdout=out_file)) pass @@ -268,7 +268,7 @@ class Testbed(mod.Testbed): while max_waiting_time > 0 and over_processes < total_processes: # Check for errors if not error_queue.empty(): - print('Failure while shutting down: {}'.format(str(error_queue.get()))) + print('Failure while shutting down: %s' % str(error_queue.get())) over_processes += 1 try: # Check for results @@ -300,7 +300,7 @@ class Testbed(mod.Testbed): while max_waiting_time > 0 and over_processes < total_processes: # Check for errors if not error_queue.empty(): - print('Failure while shutting down: {}'.format(str(error_queue.get()))) + print('Failure while shutting down: %s' % str(error_queue.get())) over_processes += 1 try: # Check for results -- cgit v1.2.3