def send_email_report(job_id): conf = EmailConf.get_instance() if not conf.active: return job = Job.objects.get(jobid=job_id) if _is_self_backup(job): # ignore reports of self backup return procedure = job.procedure computer = procedure.computer stdin = get_stdin() extra_fields = get_report_extra_fields(stdin) fields = { "computer" : computer, "procedure" : procedure, "job" : job, "rate" : extra_fields["Rate"], "compression" : extra_fields["Software Compression"], "encryption" : extra_fields["Encryption"], "stdin" : stdin } message = render_to_string("email_report", **fields) subject = render_to_string("subject", **fields).strip() send_email(subject, message)
def get_config_file(self): config = Config.get_instance() return render_to_string("bacula-fd", director_name=config.director_name, password=self.password, name=self.bacula_name, os=self.operating_systems, nimbus=False)
def configure(self): nimbuscomputer = Computer.objects.get(id=1) url = "http://%s:%d" % (self.address, settings.NIMBUS_CLIENT_PORT) proxy = xmlrpclib.ServerProxy(url) proxy.save_keys(self.crypto_info.pem, nimbuscomputer.crypto_info.certificate) config = Config.get_instance() fdconfig = render_to_string("bacula-fd", director_name=config.director_name, password=self.password, name=self.name, os=self.operation_system) proxy.save_config(unicode(fdconfig)) proxy.restart_bacula()
def configure(self): nimbuscomputer = Computer.objects.get(id=1) url = "http://%s:%d" % (self.address, settings.NIMBUS_CLIENT_PORT) socket.setdefaulttimeout(40) proxy = xmlrpclib.ServerProxy(url) proxy.save_keys(self.crypto_info.pem, nimbuscomputer.crypto_info.certificate) config = Config.get_instance() fdconfig = render_to_string("bacula-fd", director_name=config.director_name, password=self.password, name=self.name, os=self.operation_system) proxy.save_config(unicode(fdconfig)) proxy.restart_bacula()