Commit | Line | Data |
---|---|---|
0235b0db | 1 | # SPDX-License-Identifier: GPL-2.0-only |
0076e742 SM |
2 | # |
3 | # Copyright (C) 2019 EfficiOS Inc. | |
4 | # | |
0076e742 SM |
5 | |
6 | import bt2 | |
7 | from cli_params_to_string import to_string | |
8 | ||
9 | ||
10 | @bt2.plugin_component_class | |
11 | class SourceWithQueryThatPrintsParams( | |
12 | bt2._UserSourceComponent, message_iterator_class=bt2._UserMessageIterator | |
13 | ): | |
14 | @classmethod | |
15 | def _user_query(cls, executor, obj, params, method_obj): | |
16 | if obj == 'please-fail': | |
17 | raise ValueError('catastrophic failure') | |
18 | ||
19 | return obj + ':' + to_string(params) | |
20 | ||
21 | ||
22 | bt2.register_plugin(__name__, "query") |