CME(1p) | User Contributed Perl Documentation | CME(1p) |
cme - Check or edit configuration data with Config::Model
version 1.038
# general synopsis cme [ global_options ] command application [ options ] [ file ] [ modification_instructions ] # edit dpkg config with GUI (and Config::Model::Dpkg) cme edit dpkg # read data from arbitrary file (for model read from alternate file) cme check dpkg-copyright -file path/to/file # edit /etc/sshd_config (with Config::Model::OpenSsh) sudo cme edit sshd # edit ~/.ssh/config (with Config::Model::OpenSsh) cme edit ssh # just check the validity of a file. Both commands are equivalent cme check multistrap file.conf cme check multistrap -file file.conf # check dpkg files, update deprecated parameters and save cme migrate dpkg # like migrate, but also apply all suggested fixes cme fix dpkg # modify configuration with command line cme modify dpkg source 'format="(3.0) quilt"' # likewise with an application that accepts file override cme modify dpkg-copyright 'Comment="Modified with cme"' # edit a file (file name specification is mandatory here) cme edit multistrap my.conf # map conf data to a fuse file system cme fusefs multistrap my.conf -d fuse_dir # likewise for dpkg data cme fusefs dpkg -d fuse_dir # list all available applications (depends on your installation) cme list
Depending on the command described below, "cme" program will use Config::Model configuration descriptions to check or modify or fix configuration files.
The 3rd parameter specify the application you want to work on. Most of the time, the relevant configuration file(s) will be found by cme. This is the most simple case. For instance:
sudo cme check popcon
Some application like "multistrap" have no constraint on the configuration file name and will require you to specify your configuration file name:
cme check multistrap raspbian.conf
or
cme check multistrap -file raspbian.conf
The configuration of an application can take different forms. Either several files (like debian packages), a single file with a predefined file (popcon), or a single file with an arbitrary file name (multistrap).
When needed the configuration file name is specified as the 3rd command argument, i.e. "cme command application file_name". This applies if the application requires a configuration file name (like multistrap), or if the application allows configuration file override.
This section describes the main commands shipped with cme. Other Config::Model extensions can bring more command. Run "cme help" to get the list of available commands on your system.
Show a list all applications where a model is available. This list depends on installed Config::Model modules.
Edit a configuration. By default, a Tk GUI will be opened If Config::Model::TkUI is installed. See App::Cme::Command::edit.
Edit the configuration with a shell like interface. See App::Cme::Command::shell.
Checks the content of the configuration file of an application. See App::Cme::Command::check.
Update deprecated parameters (old value are saved to new parameters) and save the new configuration. See App::Cme::Command::migrate.
Migrate data and fix warnings. See App::Cme::Command::fix.
Modify a configuration file with the values passed on the command line. See App::Cme::Command::modify.
Update the content of the configuration file from external data. Currently, only dpkg-copyright model support update sub command. See App::Cme::Command::update.
Search configuration data for a specific string. See App::Cme::Command::search.
Map the configuration file content to a FUSE virtual file system on a directory specified with option "-fuse-dir". Modifications done in the fuse file system are saved to the configuration file when the "fusermount -u" is run.
The following options are available for all commands:
You can use this option for model that require the target file to be specified (e.g. multitrap model), but file can in this case be also specified with the 4th command argument. E.g. these 2 commands have the same effect:
cme check multistrap foo.conf cme check multistrap -file foo.conf
You can use cme from another program by using "-ui simple" option. This way you will be able to send command on the standard input of "cme" and get the results from the standard output.
All Config::Model logging is now based on Log::Log4perl. Logging can be configured in the following files:
~/.log4config-model
/etc/log4config-model.conf
A sample of a ".log4config-model" is provided in contrib directory in "Config::Model" distribution of on github <https://github.com/dod38fr/config-model/blob/master/contrib/log4config-model>
Without these files, the following Log4perl config is used:
log4perl.rootLogger=WARN, Screen log4perl.logger.Model.Legacy = INFO, SimpleScreen log4perl.additivity.Model.Legacy = 0 log4perl.appender.Screen = Log::Log4perl::Appender::Screen log4perl.appender.Screen.stderr = 0 log4perl.appender.Screen.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %M %m (line %L)%n log4perl.appender.SimpleScreen = Log::Log4perl::Appender::Screen log4perl.appender.SimpleScreen.stderr = 0 log4perl.appender.SimpleScreen.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.SimpleScreen.layout.ConversionPattern = %p: %m%n log4perl.oneMessagePerAppender = 1
Log4perl uses the following categories:
More categories will come.
cme exits 0 when no errors are found. Exit 1 otherwise.
"cme" imposes a specific ordering of the parameters of a configuration file. This ordering is derived from the documentation of the configuration, like ssh_confg. "cme" writes back files using this ordering.
Thus, the diff between the original configuration files and the new version of the file may be more important than expected when "cme" is used the first time.
Comments are not supported in some applidations (like the one that use YAML in configuration files). Comments are dropped when using "cme" to edit or modify such files. For more details, see Available backend <https://github.com/dod38fr/config-model/wiki/Available-models-and-backends#Available_backend> page.
If a configuration model is not up-to-date, you will get errors complaining about unknown parameters. In such a case, please file a bug on github <https://github.com/dod38fr/cme-perl/issues> or fix the model and send a pull request. You can see this example from OpenSsh <https://github.com/dod38fr/config-model/wiki/New-parameter-for-openssh-example> to learn how to fix a model.
For more information, please check:
In alphabetical order:
Ross Vandegrift
Feedback from users are highly desired. If you find this module useful, please share your use cases, success stories with the author.
Config::Model::Model, Config::Model::Instance, Config::Model::Node, Config::Model::HashId, Config::Model::ListId, Config::Model::WarpedNode, Config::Model::Value
Dominique Dumont
This software is Copyright (c) 2014-2022 by Dominique Dumont <ddumont@cpan.org>.
This is free software, licensed under:
The GNU Lesser General Public License, Version 2.1, February 1999
2022-03-13 | perl v5.34.0 |