LinchPin Command-Line API¶
The linchpin.cli module provides an API for writing a command-line interface, the LinchPin Command Line Shell implementation being the reference implementation.
-
class
linchpin.cli.
LinchpinCli
(ctx)[source]¶ -
find_include
(filename, ftype='topology')[source]¶ Find the included file to be acted upon.
Parameters: - filename – name of file from to be loaded
- ftype – the file type to locate: topology, layout (default: topology)
-
lp_destroy
(targets=(), run_id=None, tx_id=None)[source]¶ This function takes a list of targets, and performs a destructive teardown, including undefining nodes, according to the target(s).
See also
lp_down - currently unimplemented
Parameters: - targets – A tuple of targets to destroy.
- run_id – An optional run_id to use
- tx_id – An optional tx_id to use
-
lp_down
(pinfile, targets=(), run_id=None)[source]¶ This function takes a list of targets, and performs a shutdown on nodes in the target’s topology. Only providers which support shutdown from their API (Ansible) will support this option.
CURRENTLY UNIMPLEMENTED
See also
lp_destroy
Parameters: - pinfile – Provided PinFile, with available targets,
- targets – A tuple of targets to provision.
-
lp_init
(providers=['libvirt'])[source]¶ Initializes a linchpin project. Creates the necessary directory structure, includes PinFile, topologies and layouts for the given provider. (Default: Dummy. Other providers not yet implemented.)
Parameters: providers – A list of providers for which templates (and a target) will be provided into the workspace. NOT YET IMPLEMENTED
-
lp_up
(targets=(), run_id=None, tx_id=None)[source]¶ This function takes a list of targets, and provisions them according to their topology.
Parameters: - targets – A tuple of targets to provision
- run_id – An optional run_id if the task is idempotent
- tx_id – An optional tx_id if the task is idempotent
-
pf_data
¶ getter for pinfile template data
-
pinfile
¶ getter function for pinfile name
-
workspace
¶ getter function for context workspace
-
-
class
linchpin.cli.context.
LinchpinCliContext
[source]¶ Context object, which will be used to manage the cli, and load the configuration file
-
load_config
(lpconfig=None)[source]¶ Update self.cfgs from the linchpin configuration file (linchpin.conf).
The following paths are used to find the config file. The search path defaults to the first-found order:
* /etc/linchpin.conf * /linchpin/library/path/linchpin.conf * <workspace>/linchpin.conf
An alternate search_path can be passed.
Parameters: search_path – A list of paths to search a linchpin config (default: None)
-
log
(msg, **kwargs)[source]¶ Logs a message to a logfile or the console
Parameters: - msg – message to log
- lvl – keyword argument defining the log level
- msg_type – keyword argument giving more flexibility.
Note
Only msg_type STATE is currently implemented.
-
pinfile
¶ getter function for pinfile name
-
setup_logging
()[source]¶ Setup logging to a file, console, or both. Modifying the linchpin.conf appropriately will provide functionality.
-
workspace
¶ getter function for workspace
-