diff --git a/fuelweb_test/helpers/os_actions.py b/fuelweb_test/helpers/os_actions.py index 510ce2d3b..8238d3138 100644 --- a/fuelweb_test/helpers/os_actions.py +++ b/fuelweb_test/helpers/os_actions.py @@ -125,7 +125,7 @@ class OpenStackActions(common.Common): with open(scenario, "r+") as f: scenario = f.read() except Exception as exc: - logger.info("Error opening file: %s" % exc) + logger.info("Error opening file: {:s}".format(exc)) raise Exception() image_id = self._get_cirros_image().id security_group[self.keystone.tenant_id] =\ @@ -315,7 +315,7 @@ class OpenStackActions(common.Common): def get_md5sum(self, file_path, controller_ssh, vm_ip, creds=()): logger.info("Get file md5sum and compare it with previous one") out = self.execute_through_host( - controller_ssh, vm_ip, "md5sum %s" % file_path, creds) + controller_ssh, vm_ip, "md5sum {:s}".format(file_path), creds) return out['stdout'] def execute_through_host(self, ssh, vm_host, cmd, creds=()): diff --git a/fuelweb_test/models/environment.py b/fuelweb_test/models/environment.py index 5f86fe4eb..7fe6829cd 100644 --- a/fuelweb_test/models/environment.py +++ b/fuelweb_test/models/environment.py @@ -616,13 +616,13 @@ class EnvironmentModel(object): wait( lambda: not admin_remote.execute( - "grep 'Fuel node deployment' '%s'" % log_path + "grep 'Fuel node deployment' '{:s}'".format(log_path) )['exit_code'], timeout=(float(settings.PUPPET_TIMEOUT)) ) result = admin_remote.execute( "grep 'Fuel node deployment " - "complete' '%s'" % log_path)['exit_code'] + "complete' '{:s}'".format(log_path))['exit_code'] if result != 0: raise Exception('Fuel node deployment failed.') self.bootstrap_image_check() diff --git a/fuelweb_test/models/fuel_web_client.py b/fuelweb_test/models/fuel_web_client.py index 5350bd1b2..43ed9b73b 100644 --- a/fuelweb_test/models/fuel_web_client.py +++ b/fuelweb_test/models/fuel_web_client.py @@ -579,7 +579,7 @@ class FuelWebClient(object): self.ssl_configure(cluster_id) if not cluster_id: - raise Exception("Could not get cluster '%s'" % name) + raise Exception("Could not get cluster '{:s}'".format(name)) # TODO: rw105719 # self.client.add_syslog_server( # cluster_id, self.environment.get_host_node_ip(), port) diff --git a/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py b/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py index c6c77cffe..2d7db248f 100644 --- a/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py +++ b/fuelweb_test/tests/plugins/plugin_contrail/test_fuel_plugin_contrail.py @@ -84,7 +84,7 @@ class ContrailPlugin(TestBasic): def _prepare_contrail_plugin(self, slaves=None, pub_net=False): """Copy necessary packages to the master node and install them""" - self.env.revert_snapshot("ready_with_%d_slaves" % slaves) + self.env.revert_snapshot("ready_with_{:d}_slaves".format(slaves)) with self.env.d_env.get_admin_remote() as remote: diff --git a/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py b/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py index bfae06478..bab241c99 100644 --- a/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py +++ b/fuelweb_test/tests/plugins/plugin_lma_collector/test_plugin_lma_collector.py @@ -157,7 +157,8 @@ class TestLmaCollectorPlugin(TestBasic): for plugin in plugins: plugin_name = plugin['name'] plugin_version = plugin['version'] - msg = "Plugin '%s' couldn't be found. Test aborted" % plugin_name + msg = "Plugin '{:s}' couldn't be found. " \ + "Test aborted".format(plugin_name) assert_true( self.fuel_web.check_plugin_exists(cluster_id, plugin_name), msg) diff --git a/fuelweb_test/tests/test_admin_node.py b/fuelweb_test/tests/test_admin_node.py index 8b34402b0..8c0625492 100644 --- a/fuelweb_test/tests/test_admin_node.py +++ b/fuelweb_test/tests/test_admin_node.py @@ -83,7 +83,7 @@ class TestAdminNode(TestBasic): with self.env.d_env.get_admin_remote() as remote: ps_output = remote.execute('ps ax')['stdout'] astute_master = filter(lambda x: 'astute master' in x, ps_output) - logger.info("Found astute processes: %s" % astute_master) + logger.info("Found astute processes: {:s}".format(astute_master)) assert_equal(len(astute_master), 1) astute_workers = filter(lambda x: 'astute worker' in x, ps_output) logger.info( diff --git a/fuelweb_test/tests/test_ceph.py b/fuelweb_test/tests/test_ceph.py index 775bc0c61..d161cf72a 100644 --- a/fuelweb_test/tests/test_ceph.py +++ b/fuelweb_test/tests/test_ceph.py @@ -630,7 +630,7 @@ class VmBackedWithCephMigrationBasic(TestBasic): neutron=True, scenario='./fuelweb_test/helpers/instance_initial_scenario', label=net_name) - logger.info("Srv is currently in status: %s" % srv.status) + logger.info("Srv is currently in status: {:s}".format(srv.status)) # Prepare to DHCP leases checks net_name = self.fuel_web.get_cluster_predefined_networks_name( @@ -648,7 +648,7 @@ class VmBackedWithCephMigrationBasic(TestBasic): logger.info("Assigning floating ip to server") floating_ip = os.assign_floating_ip(srv) srv_host = os.get_srv_host_name(srv) - logger.info("Server is on host %s" % srv_host) + logger.info("Server is on host {:s}".format(srv_host)) wait(lambda: tcp_ping(floating_ip.ip, 22), timeout=120) @@ -723,12 +723,12 @@ class VmBackedWithCephMigrationBasic(TestBasic): neutron=True, scenario='./fuelweb_test/helpers/instance_initial_scenario', label=net_name) - logger.info("Srv is currently in status: %s" % srv.status) + logger.info("Srv is currently in status: {:s}".format(srv.status)) logger.info("Assigning floating ip to server") floating_ip = os.assign_floating_ip(srv) srv_host = os.get_srv_host_name(srv) - logger.info("Server is on host %s" % srv_host) + logger.info("Server is on host {:s}".format(srv_host)) self.show_step(13) logger.info("Create volume") @@ -766,7 +766,7 @@ class VmBackedWithCephMigrationBasic(TestBasic): remote, floating_ip.ip, 'sudo mount /dev/vdb /mnt', creds) - logger.info("out of mounting volume is: %s" % out['stdout']) + logger.info("out of mounting volume is: {:s}".format(out['stdout'])) with self.fuel_web.get_ssh_for_node("slave-01") as remote: out = os.execute_through_host( @@ -879,8 +879,10 @@ class CheckCephPartitionsAfterReboot(TestBasic): if before_reboot_partitions != after_reboot_partitions: logger.info("Partitions don`t match") - logger.info("Before reboot: %s" % before_reboot_partitions) - logger.info("After reboot: %s" % after_reboot_partitions) + logger.info("Before reboot: " + "{:s}".format(before_reboot_partitions)) + logger.info("After reboot: " + "{:s}".format(after_reboot_partitions)) raise Exception() self.show_step(10, node) @@ -900,8 +902,10 @@ class CheckCephPartitionsAfterReboot(TestBasic): if before_reboot_partitions != after_reboot_partitions: logger.info("Partitions don`t match") - logger.info("Before reboot: %s" % before_reboot_partitions) - logger.info("After reboot: %s" % after_reboot_partitions) + logger.info("Before reboot: " + "{:s}".format(before_reboot_partitions)) + logger.info("After reboot: " + "{:s}".format(after_reboot_partitions)) raise Exception() self.show_step(13, node) diff --git a/fuelweb_test/tests/test_rh_compute.py b/fuelweb_test/tests/test_rh_compute.py index a99c4d305..545bc2a6e 100644 --- a/fuelweb_test/tests/test_rh_compute.py +++ b/fuelweb_test/tests/test_rh_compute.py @@ -149,19 +149,19 @@ class RhHA(TestBasic): ) if settings.RH_SERVER_URL: - reg_command = reg_command + " --serverurl={0}".format( + reg_command += " --serverurl={0}".format( settings.RH_SERVER_URL) if settings.RH_REGISTERED_ORG_NAME: - reg_command = reg_command + " --org={0}".format( + reg_command += " --org={0}".format( settings.RH_REGISTERED_ORG_NAME) if settings.RH_RELEASE: - reg_command = reg_command + " --release={0}".format( + reg_command += " --release={0}".format( settings.RH_RELEASE) if settings.RH_ACTIVATION_KEY: - reg_command = reg_command + " --activationkey={0}".format( + reg_command += " --activationkey={0}".format( settings.RH_ACTIVATION_KEY) if settings.RH_POOL_HASH: @@ -495,16 +495,16 @@ class RhHA(TestBasic): :param hostname: Old compute hostname. """ cmd = ("source ~/openrc && for i in $(nova service-list | " - "awk '/%s/{print $2}'); do nova service-delete $i; " - "done" % hostname) + "awk '/{:s}/{{print $2}}'); do nova service-delete $i; " + "done".format(hostname)) result = remote.execute(cmd) logger.debug(result) asserts.assert_equal(result['exit_code'], 0, 'Can not remove ' 'old nova computes') cmd = ("source ~/openrc && for i in $(neutron agent-list | " - "awk '/%s/{print $2}'); do neutron agent-delete $i; " - "done" % hostname) + "awk '/{:s}/{{print $2}}'); do neutron agent-delete $i; " + "done".format(hostname)) result = remote.execute(cmd) logger.debug(result) asserts.assert_equal(result['exit_code'], 0, 'Can not remove ' diff --git a/system_test/helpers/decorators.py b/system_test/helpers/decorators.py index 14b6a36ba..1ecbf3273 100644 --- a/system_test/helpers/decorators.py +++ b/system_test/helpers/decorators.py @@ -45,7 +45,7 @@ def make_snapshot_if_step_fail(func): case_name = getattr(func, '_base_class', None) step_num = getattr(func, '_step_num', None) config_name = getattr(func, '_config_case_group', None) - description = "Failed in method '%s'." % func.__name__ + description = "Failed in method '{:s}'.".format(func.__name__) if args[0].env is not None: try: create_diagnostic_snapshot(args[0].env, diff --git a/utils/jenkins/fuel_logs.py b/utils/jenkins/fuel_logs.py index 3568fb496..d873f7a70 100755 --- a/utils/jenkins/fuel_logs.py +++ b/utils/jenkins/fuel_logs.py @@ -526,8 +526,11 @@ class PuppetLog(AbstractLog): line = record.get('line', None) if not (log and time and line): continue - IO.output("%s %s %s" % (self.node_name(log), - time.isoformat(), line)) + IO.output("{name:s} {time:s} {line:s}".format( + name=self.node_name(log), + time=time.isoformat(), + line=line + )) def sort_log(self): """