def ping_jk_server(self): jk_handler = JenkinsApi(self.cleaned_data['jenkins_server']) if not jk_handler.jk_ping(): raise forms.ValidationError("Can't connect jenkins server !")
def delete_job_after(sender, instance, **kwargs): js_obj = JenkinsApi(instance.jenkins_server) if js_obj.jk_ping(): js_obj.delete_job(instance.job_name)