Revision 73415719 scripts/gnt-cluster
b/scripts/gnt-cluster | ||
---|---|---|
193 | 193 |
SubmitOpCode(op) |
194 | 194 |
|
195 | 195 |
|
196 |
def SearchTags(opts, args): |
|
197 |
"""Searches the tags on all the cluster. |
|
198 |
|
|
199 |
""" |
|
200 |
op = opcodes.OpSearchTags(pattern=args[0]) |
|
201 |
result = SubmitOpCode(op) |
|
202 |
if not result: |
|
203 |
return 1 |
|
204 |
result = list(result) |
|
205 |
result.sort() |
|
206 |
for path, tag in result: |
|
207 |
print "%s %s" % (path, tag) |
|
208 |
|
|
209 |
|
|
196 | 210 |
# this is an option common to more than one command, so we declare |
197 | 211 |
# it here and reuse it |
198 | 212 |
node_option = make_option("-n", "--node", action="append", dest="nodes", |
... | ... | |
269 | 283 |
"tag...", "Add tags to the cluster"), |
270 | 284 |
'remove-tags': (RemoveTags, ARGS_ANY, [DEBUG_OPT, TAG_SRC_OPT], |
271 | 285 |
"tag...", "Remove tags from the cluster"), |
286 |
'search-tags': (SearchTags, ARGS_ONE, |
|
287 |
[DEBUG_OPT], "", "Searches the tags on all objects on" |
|
288 |
" the cluster for a given pattern (regex)"), |
|
272 | 289 |
} |
273 | 290 |
|
274 | 291 |
if __name__ == '__main__': |
Also available in: Unified diff