1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-03 18:56:55 +00:00

modules g*: use f-strings (#10958)

* modules g*: use f-strings

* add changelog frag

* remove extraneous to_native()
This commit is contained in:
Alexei Znamensky 2025-10-25 11:54:38 +13:00 committed by GitHub
parent a3987c9844
commit b67e7c83cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 250 additions and 245 deletions

View file

@ -272,13 +272,13 @@ class GitlabMilestones(object):
if _found:
return _found[0].id
else:
self._module.fail_json(msg="milestone '%s' not found." % _title)
self._module.fail_json(msg=f"milestone '{_title}' not found.")
def check_date(self, _date):
try:
datetime.strptime(_date, '%Y-%m-%d')
except ValueError:
self._module.fail_json(msg="milestone's date '%s' not in correct format." % _date)
self._module.fail_json(msg=f"milestone's date '{_date}' not in correct format.")
return _date
def delete_milestone(self, var_obj):
@ -460,9 +460,9 @@ def main():
# if both not found, module must exist
if not gitlab_project_id and not gitlab_group_id:
if gitlab_project and not gitlab_project_id:
module.fail_json(msg="project '%s' not found." % gitlab_project)
module.fail_json(msg=f"project '{gitlab_project}' not found.")
if gitlab_group and not gitlab_group_id:
module.fail_json(msg="group '%s' not found." % gitlab_group)
module.fail_json(msg=f"group '{gitlab_group}' not found.")
this_gitlab = GitlabMilestones(module=module, gitlab_instance=gitlab_instance, group_id=gitlab_group_id,
project_id=gitlab_project_id)