Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow CLI argument defaults to be pulled from Configuration #450

Closed
JeffreyDevloo opened this issue May 2, 2018 · 4 comments
Closed

Allow CLI argument defaults to be pulled from Configuration #450

JeffreyDevloo opened this issue May 2, 2018 · 4 comments
Assignees
Milestone

Comments

@JeffreyDevloo
Copy link
Contributor

Feature description

Since the addition of expose to cli since #447, test parameters can be tweaked.
For further automation, the parameters should be retrievable through Configuration

The healthcheck stamp an example Configuration based on the current parameters and then just load in the file for every group.
Click documentation: http://click.pocoo.org/5/commands/#overriding-defaults

@wimpers wimpers added this to the Roadmap milestone May 4, 2018
@wimpers
Copy link

wimpers commented May 4, 2018

Set to Roadmap. If required by @openvstorage/operations please leave a remark.

@JeffreyDevloo JeffreyDevloo self-assigned this May 28, 2018
@JeffreyDevloo JeffreyDevloo modified the milestones: Roadmap, M May 29, 2018
@JeffreyDevloo
Copy link
Contributor Author

Pushing it back to M on request of Ops

@JeffreyDevloo
Copy link
Contributor Author

Fixed by #471
Packaged in

Usage

The key to provide the defaults under: /ovs/healthcheck/default_arguments

Configs are to be set under MODULE : TEST: PARAM NAME PYTHONIFIED
Example:

{
    "alba": {
        "disk-safety-test": {
            "include_errored_as_dead": false, 
            "skip_backend": [], 
            "backend": []
        }
}

The possible value is dependent on the type of argument to be set. When an option can be specified multiple times: the argument has to be a list. For other types (text and numeric values) just follow your intuition

A complete dict of all possible options and their current value can be generated:

from ovs.extensions.healthcheck.expose_to_cli import HealthCheckCLIRunner
HealthCheckCLIRunner.generate_configuration_options?
Type:        instancemethod
String form: <bound method type.generate_configuration_options of <class 'ovs.extensions.healthcheck.expose_to_cli.HealthCheckCLIRunner'>>
File:        /opt/OpenvStorage/ovs/extensions/healthcheck/expose_to_cli.py
Definition:  HealthCheckCLIRunner.generate_configuration_options(cls, re_use_current_settings=False)
Docstring:
Generate a complete structure indicating where tweaking is possible together with the default values
:param re_use_current_settings: Re-use the settings currently set. Defaults to False
It will regenerate a complete structure and apply the already set values if set to True
:return: All options available to the healthcheck
:rtype: dict

Setting all possible options first before tweaking them:

from ovs.extensions.generic.configuration import Configuration
from ovs.extensions.healthcheck.expose_to_cli import HealthCheckShared, HealthCheckCLIRunner
Configuration.set(HealthCheckShared.CONTEXT_SETTINGS_KEY, HealthCheckCLIRunner.generate_configuration_options())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants