From 67ef53d93bdf1f8c9b5af6b2b0867abe6c2ea09a Mon Sep 17 00:00:00 2001 From: Chenxiong Qi Date: Apr 22 2019 05:47:54 +0000 Subject: Use Logger.warning instead of Logger.warn Logger.warn is deprecated. Using Logger.warning to suppress deprecation warning messages. Signed-off-by: Chenxiong Qi --- diff --git a/tests/test_koji_service.py b/tests/test_koji_service.py index 45adcfc..55390b7 100644 --- a/tests/test_koji_service.py +++ b/tests/test_koji_service.py @@ -320,7 +320,7 @@ class KojiServiceTestCase(unittest.TestCase): add_tags = [{'name': 'module-123', 'priority': 30}] self.koji.update_tag_inheritance('f27-build', add_tags) - log.warn.assert_called_with( + log.warning.assert_called_with( ("Tag f27-build has an inheritance with the same priority 30 as " "tag module-123")) @@ -470,7 +470,7 @@ class KojiServiceTestCase(unittest.TestCase): self.koji.koji_proxy.newRepo.assert_called_with( 'rhel-8.0-build', debuginfo=True, src=True) - log.warn.assert_has_calls( + log.warning.assert_has_calls( [mock.call('Warning: %s is not a build tag', 'rhel-8.0-build'), mock.call('Warning: tag %s has an empty arch list', 'rhel-8.0-build')], @@ -505,7 +505,7 @@ class KojiServiceTestCase(unittest.TestCase): self.koji.koji_proxy.newRepo.assert_called_with( 'rhel-8.0-build', debuginfo=True, src=True) - log.warn.assert_has_calls( + log.warning.assert_has_calls( [mock.call('Warning: %s is not a build tag', 'rhel-8.0-build'), mock.call('Warning: tag %s has an empty arch list', 'rhel-8.0-build')], diff --git a/ursa_major/handlers/add_module.py b/ursa_major/handlers/add_module.py index 0aca59e..ebf893a 100644 --- a/ursa_major/handlers/add_module.py +++ b/ursa_major/handlers/add_module.py @@ -60,14 +60,14 @@ class AddModuleHandler(BaseHandler): if self.args.update_inheritance_only: to_update_config = False - log.warn("Will not update config file because --update-inheritance-only " - "is specified, even if the specified module config does not " - "exist in tag config file.") + log.warning("Will not update config file because --update-inheritance-only " + "is specified, even if the specified module config does not " + "exist in tag config file.") if self.args.update_config_only: to_update_inheritance = False - log.warn("Will not update tag %s's inheritance data because --update-config-only " - "is specified, even if the latest module build's tag does not exists in " - "inheritance with specified config", self.op_tag) + log.warning("Will not update tag %s's inheritance data because --update-config-only " + "is specified, even if the latest module build's tag does not exists in " + "inheritance with specified config", self.op_tag) if self.args.module_requires: module_requires = dict(self.args.module_requires) @@ -109,12 +109,12 @@ class AddModuleHandler(BaseHandler): tag_to_add = latest_module_tag else: - log.warn("Can't find any built module in MBS with module config '%s', " - "we will not add any new module tag to inheritance data", - input_module_config) + log.warning("Can't find any built module in MBS with module config '%s', " + "we will not add any new module tag to inheritance data", + input_module_config) if not self.force: - log.warn("Will not update inheritance data nor tag config file, consider " - "to run with --force to allow updating") + log.warning("Will not update inheritance data nor tag config file, consider " + "to run with --force to allow updating") to_update_inheritance = False to_update_config = False @@ -255,7 +255,7 @@ class AddModuleHandler(BaseHandler): build_tags = self.koji.find_build_tags(self.op_tag) if not build_tags: - log.warn("No build tag found for %s, not regen any repo", self.op_tag) + log.warning("No build tag found for %s, not regen any repo", self.op_tag) else: log.info("Found build tags for %s: %r", self.op_tag, build_tags) self.koji.regen_repos(build_tags, wait=self.wait_regen_repo) diff --git a/ursa_major/handlers/add_tag.py b/ursa_major/handlers/add_tag.py index 120ba84..3a2c424 100644 --- a/ursa_major/handlers/add_tag.py +++ b/ursa_major/handlers/add_tag.py @@ -167,7 +167,7 @@ class AddTagHandler(BaseHandler): build_tags = self.koji.find_build_tags(tag) if not build_tags: - log.warn("No build tag found for %s, not regen any repo", tag) + log.warning("No build tag found for %s, not regen any repo", tag) else: log.info("Found build tags for '%s': %r", tag, build_tags) self.koji.regen_repos(build_tags, wait=self.wait_regen_repo) @@ -219,8 +219,8 @@ class AddTagHandler(BaseHandler): for tag, tag_config in self.tag_config.items(): tag_owners = tag_config.get('owners', []) if not tag_owners: - log.warn("Sending mail is enabled, but no owners set for tag %s, " - "will not send mail", tag) + log.warning("Sending mail is enabled, but no owners set for tag %s, " + "will not send mail", tag) conf_modules = tag_config.get('modules', []) try: diff --git a/ursa_major/handlers/check_config.py b/ursa_major/handlers/check_config.py index 409cb66..bbb596d 100644 --- a/ursa_major/handlers/check_config.py +++ b/ursa_major/handlers/check_config.py @@ -74,14 +74,14 @@ class CheckConfigHandler(BaseHandler): tag_owners = config.get('owners', None) if tag_owners is None or not tag_owners: - log.warn("Tag %s: missing owners", tag) + log.warning("Tag %s: missing owners", tag) if not isinstance(tag_owners, list): - log.warn("Tag %s: owners should be a list of emails", tag) + log.warning("Tag %s: owners should be a list of emails", tag) module_configs = config.get('modules', []) if not module_configs: - log.warn("Tag %s: no module specified", tag) + log.warning("Tag %s: no module specified", tag) continue # save modules by priority for checking duplicate priorities diff --git a/ursa_major/handlers/remove_module.py b/ursa_major/handlers/remove_module.py index a4dab29..e0ee5d5 100644 --- a/ursa_major/handlers/remove_module.py +++ b/ursa_major/handlers/remove_module.py @@ -48,8 +48,8 @@ class RemoveModuleHandler(BaseHandler): self.load_tag_config() if self.tag not in self.tag_config.keys(): - log.warn("Tag %s is not present in tag config file %s", - self.tag, self.tag_config_file) + log.warning("Tag %s is not present in tag config file %s", + self.tag, self.tag_config_file) try: tag_inheritance = self.koji.get_inheritance_data(self.tag) diff --git a/ursa_major/koji_service.py b/ursa_major/koji_service.py index 10edd89..6c79224 100644 --- a/ursa_major/koji_service.py +++ b/ursa_major/koji_service.py @@ -364,7 +364,7 @@ class KojiService(object): "{} as tag {}".format(child_tag['name'], add_data['priority'], add_tag['name'])) - log.warn(msg) + log.warning(msg) same_parent = [d for d in inheritance_data if d['parent_id'] == add_data['parent_id'] and @@ -438,11 +438,11 @@ class KojiService(object): tagid = taginfo['id'] tagname = taginfo['name'] if not taginfo['arches']: - log.warn("Warning: tag %s has an empty arch list", tagname) + log.warning("Warning: tag %s has an empty arch list", tagname) targets = self.get_build_targets(tagid) if not targets: - log.warn("Warning: %s is not a build tag", tagname) + log.warning("Warning: %s is not a build tag", tagname) repo_opts = {} if debuginfo: @@ -496,7 +496,7 @@ class KojiService(object): try: future.result() except Exception as exc: - log.warn("Error while re-generating repo for %s: %s", tag, str(exc)) + log.warning("Error while re-generating repo for %s: %s", tag, str(exc)) else: if not wait: log.info("Regen-repo task of tag %s is created", tag)