Revision c1513c7f
b/qa/qa-sample.json | ||
---|---|---|
27 | 27 |
"# Script to check instance status": null, |
28 | 28 |
"instance-check": null, |
29 | 29 |
|
30 |
"# Regular expression to ignore existing tags": null, |
|
31 |
"ignore-tags-re": null, |
|
32 |
|
|
30 | 33 |
"nodes": [ |
31 | 34 |
{ |
32 | 35 |
"# Master node": null, |
b/qa/qa_rapi.py | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import tempfile |
27 | 27 |
import random |
28 |
import re |
|
29 |
import itertools |
|
28 | 30 |
|
29 | 31 |
from ganeti import utils |
30 | 32 |
from ganeti import constants |
... | ... | |
416 | 418 |
]) |
417 | 419 |
|
418 | 420 |
|
421 |
def _FilterTags(seq): |
|
422 |
"""Removes unwanted tags from a sequence. |
|
423 |
|
|
424 |
""" |
|
425 |
ignore_re = qa_config.get("ignore-tags-re", None) |
|
426 |
|
|
427 |
if ignore_re: |
|
428 |
return itertools.ifilterfalse(re.compile(ignore_re).match, seq) |
|
429 |
else: |
|
430 |
return seq |
|
431 |
|
|
432 |
|
|
419 | 433 |
def TestTags(kind, name, tags): |
420 | 434 |
"""Tests .../tags resources. |
421 | 435 |
|
... | ... | |
432 | 446 |
raise errors.ProgrammerError("Unknown tag kind") |
433 | 447 |
|
434 | 448 |
def _VerifyTags(data): |
435 |
AssertEqual(sorted(tags), sorted(data))
|
|
449 |
AssertEqual(sorted(tags), sorted(_FilterTags(data)))
|
|
436 | 450 |
|
437 | 451 |
queryargs = "&".join("tag=%s" % i for i in tags) |
438 | 452 |
|
Also available in: Unified diff