Merge "Make verify_tempest_config workspace aware"

This commit is contained in:
Jenkins 2017-08-08 23:52:36 +00:00 committed by Gerrit Code Review
commit 4207dbedad

View File

@ -14,6 +14,51 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
"""
Verifies user's current tempest configuration.
This command is used for updating or user's tempest configuration file based on
api queries or replacing all option in a tempest configuration file for a full
list of extensions.
General Options
===============
-u, --update
------------
Update the config file with results from api queries. This assumes whatever is
set in the config file is incorrect.
-o FILE, --output=FILE
----------------------
Output file to write an updated config file to. This has to be a separate file
from the original one. If one isn't specified with -u the values which should
be changed will be printed to STDOUT.
-r, --replace-ext
-----------------
If specified the all option will be replaced with a full list of extensions.
Environment Variables
=====================
The command is workspace aware - it uses tempest config file tempest.conf
located in ./etc/ directory.
The path to the config file and it's name can be changed through environment
variables.
TEMPEST_CONFIG_DIR
------------------
Path to a directory where tempest configuration file is stored. If the variable
is set, the default path (./etc/) is overridden.
TEMPEST_CONFIG
--------------
Name of a tempest configuration file. If the variable is specified, the default
name (tempest.conf) is overridden.
"""
import argparse import argparse
import os import os
import re import re
@ -41,8 +86,8 @@ LOG = logging.getLogger(__name__)
def _get_config_file(): def _get_config_file():
default_config_dir = os.path.join(os.path.abspath( config_dir = os.getcwd()
os.path.dirname(os.path.dirname(os.path.dirname(__file__)))), "etc") default_config_dir = os.path.join(config_dir, "etc")
default_config_file = "tempest.conf" default_config_file = "tempest.conf"
conf_dir = os.environ.get('TEMPEST_CONFIG_DIR', default_config_dir) conf_dir = os.environ.get('TEMPEST_CONFIG_DIR', default_config_dir)
@ -370,8 +415,8 @@ def _parser_add_args(parser):
help="Output file to write an updated config file to. " help="Output file to write an updated config file to. "
"This has to be a separate file from the " "This has to be a separate file from the "
"original config file. If one isn't specified " "original config file. If one isn't specified "
"with -u the new config file will be printed to " "with -u the values which should be changed "
"STDOUT") "will be printed to STDOUT")
parser.add_argument('-r', '--replace-ext', action='store_true', parser.add_argument('-r', '--replace-ext', action='store_true',
help="If specified the all option will be replaced " help="If specified the all option will be replaced "
"with a full list of extensions") "with a full list of extensions")