Пример #1
0
 def _extract_properties(self, entity):
     properties = {}
     properties['status'] = entity['status']
     properties['severity'] = entity['labels']['severity']
     properties['message'] = str_utils.escape(
         entity['annotations']['message'])
     return properties
Пример #2
0
 def _extract_message(self, entity):
     annotations = self._extract_annotations(entity)
     message = annotations.get('message')
     if not message:
         message = annotations.get('summary')
     if message:
         return str_utils.escape(message)
Пример #3
0
 def _extract_containers(self, entity):
     containers = []
     for container in entity.spec.containers:
         properties = {}
         properties['name'] = container.name
         properties['image'] = container.image
         properties['command'] = None
         if container.command:
             properties['command'] = str_utils.escape(" ".join(container.command))
         properties['env'] = self._extract_env(container)
         properties['env_from'] = None
         if container.env_from:
             properties['env_from'] = [env.to_dict() for env in container.env_from]
         containers.append(properties)
     return containers
Пример #4
0
 def _extract_properties(self, entity):
     properties = {}
     properties['status'] = 'active'
     properties['severity'] = entity['severity']
     properties['message'] = str_utils.escape(entity['message'])
     return properties