Merge "Read user & password from yardstick.conf in Grafana configuration"
[yardstick.git] / yardstick / cmd / commands / plugin.py
1 ##############################################################################
2 # Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
3 #
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9
10 """ Handler for yardstick command 'plugin' """
11
12 from __future__ import print_function
13
14 from __future__ import absolute_import
15 from yardstick.benchmark.core.plugin import Plugin
16 from yardstick.common.utils import cliargs
17 from yardstick.cmd.commands import change_osloobj_to_paras
18
19
20 class PluginCommands(object):   # pragma: no cover
21     """Plugin commands.
22
23        Set of commands to manage plugins.
24     """
25
26     @cliargs("input_file", type=str, help="path to plugin configuration file",
27              nargs=1)
28     def do_install(self, args):
29         """Install a plugin."""
30         param = change_osloobj_to_paras(args)
31         Plugin().install(param)
32
33     @cliargs("input_file", type=str, help="path to plugin configuration file",
34              nargs=1)
35     def do_remove(self, args):
36         """Remove a plugin."""
37         param = change_osloobj_to_paras(args)
38         Plugin().remove(param)