Home | History | Annotate | Download | only in cli

Lines Matching refs:labels

93     def _cleanup_labels(self, labels, platform=None):
94 """Removes the platform label from the overall labels"""
96 return [label for label in labels
100 return [label for label in labels
105 return labels
127 help='Only list hosts with all these labels '
166 label_info = topic_common.item_parse_info(attribute_name='labels',
193 if self.labels:
194 self.label_map = device.convert_to_label_map(self.labels)
209 # TODO(nxia): support filtering on run-time labels and status.
231 if self.labels:
232 if len(self.labels) == 1:
233 # This is needed for labels with wildcards (x86*)
234 filters['labels__name__in'] = self.labels
237 filters['multiple_labels'] = self.labels
270 # Remove the platform from the labels.
272 result['labels'] = self._cleanup_labels(result['labels'],
285 'locked_by', 'platform', 'labels']
319 labels = self.execute_rpc('get_labels', host__hostname=host)
320 results.append([[stat], acls, labels, stat['attributes']])
329 for stats, acls, labels, attributes in results:
336 labels = self._cleanup_labels(labels)
337 self.print_by_ids(labels, 'Labels', line_before=True)
439 self.parser.add_option('-b', '--labels',
440 help=('Comma separated list of labels. '
445 help='File listing the labels',
458 'platform in labels (e.g., -b '
466 label_info = topic_common.item_parse_info(attribute_name='labels',
467 inline_option='labels',
488 if self.labels:
489 self.label_map = device.convert_to_label_map(self.labels)
537 """Remove all labels from host that meet condition(label).
550 labels=labels_to_remove)
553 def _set_labels(self, host, labels):
554 """Apply labels to host (and remove all other labels).
557 @param labels: list of label names
559 condition = lambda l: l['name'] not in labels and not l['platform']
561 self.check_and_create_items('get_labels', 'add_label', labels)
562 self.execute_rpc('host_add_labels', id=host, labels=labels)
574 self.execute_rpc('host_add_labels', id=host, labels=[platform_label])
591 --labels <labels>|--blist <label_file>
613 help='Remove all labels.',
734 if self.labels or self.remove_labels:
735 self._set_labels(host, self.labels)
769 def __init__(self, hostname, platform, labels):
772 self.labels = labels
777 --labels <labels>|--blist <label_file>
798 locked=False, lock_reason='', labels=[], acls=[],
812 @param labels: A list of labels as strings.
828 obj.labels = labels
837 """Detect platform and labels from the host.
845 data = {'attributes': self.attributes, 'labels': self.labels}
848 labels=self.labels,
887 # If there are labels avaliable for host, use them.
889 labels = set(self.labels)
890 if info.labels:
891 labels.update(info.labels)
893 if labels:
894 self._set_labels(host, list(labels))
1211 labels = []
1213 labels.append('model:%s' % self.model)
1215 labels.append('pool:%s' % self.pool)
1217 labels.append('board:%s' % self.board)
1219 if labels:
1220 if len(labels) == 1:
1221 filters['labels__name__in'] = labels
1224 filters['multiple_labels'] = labels
1298 labels = []
1300 labels.append('board:%s' % self.board)
1302 labels.append('model:%s' % self.model)
1304 labels.append('critical_pool:%s' % self.pool)
1305 if labels:
1306 label_map = device.convert_to_label_map(labels)