Пример #1
0
 public function createIssue(IncidentInterface $incident)
 {
     $description = 'Se nos informó que el host %s fue detectado en un incidente del tipo "%s".';
     $uploadFile = array();
     if (file_exists($this->evidence_directory . $incident->getEvidenceFilePath(true))) {
         $upload = json_decode($this->getClient()->api('attachment')->upload(file_get_contents($this->evidence_directory . $incident->getEvidenceFilePath(true))));
         $uploadFile = array(array('token' => $upload->upload->token, 'filename' => $incident->getEvidenceFilePath(), 'description' => 'Evidence file: ' . $incident->getEvidenceFilePath(), 'content_type' => mime_content_type($this->evidence_directory . $incident->getEvidenceFilePath(true))));
     }
     $issue = $this->getClient()->api('issue')->create(array('project_id' => $this->project_id, 'subject' => sprintf('Host %s en incidente "%s"', $incident->getHostAddress(), $incident->getType()), 'description' => sprintf($description, $incident->getHostAddress(), $incident->getType()), 'category_id' => $this->getClient()->api('issue_category')->getIdByName($this->project_id, $incident->getType()->getName()), 'tracker_id' => $this->getClient()->api('tracker')->getIdByName($this->tracker_name), 'watcher_user_ids' => $this->getClient()->api('user')->getIdByUsername('cert'), 'uploads' => $uploadFile));
     $incident->setRedmineIssue($issue);
     return $issue;
 }
Пример #2
0
 public function getBody(IncidentInterface $incident, $type = 'html')
 {
     $parameters = array('incident' => $incident, 'txtOrHtml' => $type);
     $template = $incident->getReportEdit() ? $incident->getReportEdit() : $this->reports_path . '/' . $incident->getType()->getSlug() . 'Report.html.twig';
     return $this->templating->render($template, $parameters);
 }