core/influx: reuse _locate_functions_or_prompt to choose the data provider
This commit is contained in:
parent
0517f7ffb8
commit
68019c80db
1 changed files with 6 additions and 10 deletions
|
@ -132,16 +132,12 @@ def main() -> None:
|
|||
|
||||
@main.command(name='populate', short_help='populate influxdb')
|
||||
@click.option('--reset', is_flag=True, help='Reset Influx measurements before inserting', show_default=True)
|
||||
@click.argument('MODULE', type=str, required=True)
|
||||
def populate(module: str, reset: bool) -> None:
|
||||
from .stats import guess_data_providers
|
||||
providers = guess_data_providers(module)
|
||||
# meh.. encapsulate in guess_data_providers?
|
||||
if 'inputs' in providers:
|
||||
del providers['inputs']
|
||||
# todo could do interactive thing? same way as in hpi query
|
||||
[(k, f)] = providers.items()
|
||||
magic_fill(f, reset=reset)
|
||||
@click.argument('FUNCTION_NAME', type=str, required=True)
|
||||
def populate(function_name: str, reset: bool) -> None:
|
||||
from .__main__ import _locate_functions_or_prompt
|
||||
[provider] = list(_locate_functions_or_prompt([function_name]))
|
||||
# todo could have a non-interactive version which populates from all data sources for the provider?
|
||||
magic_fill(provider, reset=reset)
|
||||
|
||||
|
||||
# todo later just add to hpi main?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue