1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 05:09:12 +00:00

modules [jk]*: use f-strings (#10970)

* modules [jk]*: use f-strings

* add changelog frag

* Apply suggestions from code review

* typing insanity
This commit is contained in:
Alexei Znamensky 2025-10-26 19:54:15 +13:00 committed by GitHub
parent 8120e9347e
commit 4a6a449fbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
46 changed files with 363 additions and 408 deletions

View file

@ -216,7 +216,7 @@ class JenkinsJob(object):
else:
return jenkins.Jenkins(self.jenkins_url)
except Exception as e:
self.module.fail_json(msg='Unable to connect to Jenkins server, %s' % to_native(e), exception=traceback.format_exc())
self.module.fail_json(msg=f'Unable to connect to Jenkins server, {e}', exception=traceback.format_exc())
def get_job_status(self):
try:
@ -227,13 +227,13 @@ class JenkinsJob(object):
return to_native(response['color'])
except Exception as e:
self.module.fail_json(msg='Unable to fetch job information, %s' % to_native(e), exception=traceback.format_exc())
self.module.fail_json(msg=f'Unable to fetch job information, {e}', exception=traceback.format_exc())
def job_exists(self):
try:
return bool(self.server.job_exists(self.name))
except Exception as e:
self.module.fail_json(msg='Unable to validate if job exists, %s for %s' % (to_native(e), self.jenkins_url),
self.module.fail_json(msg=f'Unable to validate if job exists, {e} for {self.jenkins_url}',
exception=traceback.format_exc())
def get_config(self):
@ -296,7 +296,7 @@ class JenkinsJob(object):
self.switch_state()
except Exception as e:
self.module.fail_json(msg='Unable to reconfigure job, %s for %s' % (to_native(e), self.jenkins_url),
self.module.fail_json(msg=f'Unable to reconfigure job, {e} for {self.jenkins_url}',
exception=traceback.format_exc())
def create_job(self):
@ -310,7 +310,7 @@ class JenkinsJob(object):
if not self.module.check_mode:
self.server.create_job(self.name, config_file)
except Exception as e:
self.module.fail_json(msg='Unable to create job, %s for %s' % (to_native(e), self.jenkins_url),
self.module.fail_json(msg=f'Unable to create job, {e} for {self.jenkins_url}',
exception=traceback.format_exc())
def absent_job(self):
@ -321,7 +321,7 @@ class JenkinsJob(object):
try:
self.server.delete_job(self.name)
except Exception as e:
self.module.fail_json(msg='Unable to delete job, %s for %s' % (to_native(e), self.jenkins_url),
self.module.fail_json(msg=f'Unable to delete job, {e} for {self.jenkins_url}',
exception=traceback.format_exc())
def get_result(self):