Building a client from an existing command-line configuration

Build LMCTL client module from the same configuration file that is used on the command line.

To build client module from the same configuration file that is used on the command line, you must import and use get_global_config from the lmctl.config package as shown in the following example:

from lmctl.config import get_global_config

lmctl_config = get_global_config()

# Get the TNCO instance from one of the environments
tnco_env = lmctl_config.environments['default'].tnco

# Get client
cp4na_client = tnco_env.build_client()

To build the module from a configuration file that is not in a default location, you can pass a file path to get_global_config module as shown in the following example:

from lmctl.config import get_global_config

lmctl_config = get_global_config('/path/to/my/config.yaml)