diff --git a/docs/pywbemcli/cmdshelp.rst b/docs/pywbemcli/cmdshelp.rst index 84394f2c..105bc0df 100644 --- a/docs/pywbemcli/cmdshelp.rst +++ b/docs/pywbemcli/cmdshelp.rst @@ -119,8 +119,8 @@ Help text for ``pywbemcli``: Enable deprecation warnings. Default: EnvVar PYWBEMCLI_DEPRECATION_WARNINGS, or true. -C, --connections-file FILE PATH File path of a YAML file containing named connection definitions. The default if this - option is not specified is /home/kschopmeyer/pywbemcli_connection_definitions.yaml. - EnvVar (PYWBEMCLI_CONNECTIONS_FILE) + option is not specified is the file name "pywbemcli_connection_definitions.yaml" in + the users home directory. EnvVar (PYWBEMCLI_CONNECTIONS_FILE) --pdb Pause execution in the built-in pdb debugger just before executing the command within pywbemcli. Default: EnvVar PYWBEMCLI_PDB, or false. diff --git a/docs/pywbemcli/commands.rst b/docs/pywbemcli/commands.rst index ac277b9d..2b6c73af 100644 --- a/docs/pywbemcli/commands.rst +++ b/docs/pywbemcli/commands.rst @@ -1360,24 +1360,28 @@ See :ref:`pywbemcli connection export --help` for the exact help output of the c ^^^^^^^^^^^^^^^^^^^^^^^^^^^ The ``connection list`` command lists the connection definitions in the -:term:`connections file` and also the current connection if it has not been -saved to the connections file. +:term:`connections file` and the current connection(if it has not been +saved to the connections file). Valid output formats are :term:`Table output formats`. -This shows if a connection is the current connection +This shows which connection is the current connection and if any connection is set as the default connection (:ref:`Connection select command` ). The current connection is marked with `*` in the Name column. The default connection, if defined, is marked with `#` in the Name column. +The title also displays the path of the file that is being used as the +current connections file. + .. code-block:: text pywbemcli> --server http://localhost --user me --password mypw --no-verify connection save me pywbemcli> --server http://blahblah connection list WBEM server connections(brief): (#: default, *: current) + file: ./pywbemcli_connection_definitions.yaml +--------------+------------------+----------------------------------------+ | name | server | mock-server | |--------------+------------------+----------------------------------------| diff --git a/docs/pywbemcli/generaloptions.rst b/docs/pywbemcli/generaloptions.rst index f07b69d9..24704601 100644 --- a/docs/pywbemcli/generaloptions.rst +++ b/docs/pywbemcli/generaloptions.rst @@ -640,13 +640,16 @@ command completion. .. _`--connections-file general option`: ``--connections-file`` general option -"""""""""""""""""""""""""""""""""""""" +""""""""""""""""""""""""""""""""""""" The ``--connections-file``/``-C`` general option allows the user to select a file path for the connections file. It is the file path of a YAML file that defines server configurations by name. The default if this option is -not specified is to use the configuration file -``pywbemcli_connection_definitions.yaml`` defined in the user home directory. +not specified is to use the connections file +``pywbemcli_connection_definitions.yaml`` in the users home directory. + +The users home directory is OS dependent. The connection file name is +displayed in the ``connections list`` command When this option is set, the YAML file defined with the option is used as the connections file. @@ -663,7 +666,7 @@ The connections_file is managed with the commands in the .. _`--deprecation-warnings general option`: ``--deprecation-warnings`` general option -"""""""""""""""""""""""""""""""""""""""""""" +""""""""""""""""""""""""""""""""""""""""" The ``--deprecation-warnings``/``--no-deprecation-warnings`` general option is a boolean option that controls the display of deprecation warnings on the diff --git a/pywbemtools/pywbemcli/_cmd_connection.py b/pywbemtools/pywbemcli/_cmd_connection.py index f668e153..08bb05cd 100644 --- a/pywbemtools/pywbemcli/_cmd_connection.py +++ b/pywbemtools/pywbemcli/_cmd_connection.py @@ -767,6 +767,7 @@ def build_row(options, name, svr): click.echo(format_table( sorted(rows), headers, - title='WBEM server connections({}): ({}: default, {}: current)'.format( - table_type, dflt_sym, cur_sym), + title='WBEM server connections({0}): ({1}: default, {2}: ' + 'current)\nfile: {3}'.format( + table_type, dflt_sym, cur_sym, connections.connections_file), table_format=output_format)) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py index 3bd129dc..ff328505 100644 --- a/tests/unit/conftest.py +++ b/tests/unit/conftest.py @@ -18,11 +18,12 @@ REPO_FILE_BACKUP_PATH = os.path.join(DEFAULT_CONNECTION_FILE_DIR, DEFAULT_CONNECTIONS_FILE) # if there is a config file or backup, save to this name during tests -SAVE_FILE = DEFAULT_CONNECTIONS_FILE + '.testsave' +SAVE_FILE_SUFFIX = '.testsave' +SAVE_FILE = DEFAULT_CONNECTIONS_FILE + SAVE_FILE_SUFFIX SAVE_FILE_PATH = os.path.join(DEFAULT_CONNECTION_FILE_DIR, SAVE_FILE) -SAVE_BAK_FILE = BACK_FILE + '.testsave' +SAVE_BAK_FILE = BACK_FILE + SAVE_FILE_SUFFIX SAVE_BAK_FILE_PATH = os.path.join(DEFAULT_CONNECTION_FILE_DIR, SAVE_BAK_FILE) @@ -44,6 +45,11 @@ def set_connections_file(request): This saves and restores any connections file and backup connections file in the home directory. + + This fixture should execute once per session (execution of one of the + test_*.py files) so the load of creating backups and restoring them is + very low. In case the fixture fails to restore the backed up connections + files are saved with with their full names and the suffix `.testsave`. """ if os.path.isfile(REPO_FILE_PATH): os.rename(REPO_FILE_PATH, SAVE_FILE_PATH) diff --git a/tests/unit/test_connection_cmds.py b/tests/unit/test_connection_cmds.py index fe054b26..ba48d646 100644 --- a/tests/unit/test_connection_cmds.py +++ b/tests/unit/test_connection_cmds.py @@ -913,15 +913,15 @@ ['Verify connection list with current server from general options, grid', {'args': ['list'], 'general': ['--output-format', 'table', '--server', 'http://blah']}, - {'stdout': """ -WBEM server connections(brief): (#: default, *: current) -+------------+-------------+---------------+ -| name | server | mock-server | -|------------+-------------+---------------| -| *not-saved | http://blah | | -| svrtest | http://blah | | -+------------+-------------+---------------+ -""", + {'stdout': ['WBEM server connections(brief): (#: default, *: current)', + 'file:', + 'pywbemcli_connection_definitions.yaml', + '+------------+-------------+---------------+', + '| name | server | mock-server |', + '|------------+-------------+---------------|', + '| *not-saved | http://blah | |', + '| svrtest | http://blah | |', + '+------------+-------------+---------------+'], 'test': 'innows', 'file': {'before': 'exists', 'after': 'exists'}}, None, OK],