The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

cme - Edit data of configuration managed by Config::Model

SYNOPSIS

  # general synopsis
  cme [ global_options ] command application [ options ] arguments

  # edit dpkg config with GUI
  cme edit dpkg 

  # edit /etc/sshd_config (requires Config::Model::OpenSsh)
  sudo cme edit sshd
  
  # edit ~/.ssh/config (requires Config::Model::OpenSsh)
  cme edit ssh
  
  # just check the validity of a file 
  cme check multistrap 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="quilt (3.0)"

  # 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 
  

DESCRIPTION

cme program will use Config::Model configuration descriptions to check or modify or fix configuration files.

Commands

list

Show a list all applications where a model is available. This list depends on installed Config::Model modules.

edit

Edit a configuration. By default, a Tk GUI will be opened If Config::Model::TkUI is installed. You can choose another user interface with the -ui option:

check

Checks the content of the configuration file of an application. Prints warnings and errors on STDOUT.

Example:

 cme check lcdproc
 

migrate

Checks the content of the configuration file of an application, update deprecated (old value are saved to new parameters) and save the new configuration.

For more details, see "Upgrade" in Config::Model::Value

fix

Like migrate and, when possible, fix the warnings of a configuration.

modify

Modify a configuration file with the values passed on the command line. These command must follow the syntax defined in Config::Model::Loader.

Example:

   cme modify dpkg source format="quilt (3.0)"
   cme modify multistrap my_mstrap.conf sections:base source="http://ftp.fr.debian.org"

You can search the configuration with the following options

Specifies a string or pattern to search. cme will a list of path pointing to the matching tree element and their value. See "grab(...)" in Config::Model::AnyThing for details on the path syntax.

Narrows down the search to:

element
value
key
summary

Summary text

description

description text

help

value help text

Example:

 $ cme search multistrap my_mstrap.conf -s http -narrow value
 sections:base source -> 'http://ftp.fr.debian.org'
 sections:debian source -> 'http://ftp.uk.debian.org/debian'
 sections:toolchains source -> 'http://www.emdebian.org/debian'

dump

Dump configuration content on STDOUT with Config::Model syntax.

By default, dump only custom values, i.e. different from application built-in values or model default values. You can use the -dumptype option for other types of dump:

 -dumptype [ full | preset | custom ]

Choose to dump every values (full), only preset values or only customized values (default)

fusefs

Map the configuration file content to a FUSE virtual file system. You must give a directory where the virtual file system will be mounted with option -fuse-dir. To stop (and write the configuration data back to the configuration file), run fusermount -u <mounted_fuse_dir>. Use -dfuse option to debug fuse problems.

Global options

The following options are available for all commands:

-experience

Change the experience level. By default only parameters with "beginner" experience are shown or modifiable. You can choose advanced or master level to get access to more parameters. Note that experience level can be changed in the GUI with the options menu.

-force-load

Load file even if error are found in data. Bad data are discarded

-dev

Use this option if you want to test a model under development. This option will add lib in @INC and use lib/Config/Model/models as model directory. This option is ignored when run as root.

-model-dir

Specify an alternate directory to find model files. Mostly useful for tests.

-root-dir

Specify a pseudo root directory to read and write the configuration files. (Actual default directory and file names depends on the model (See -model option). For instance, if you specify ~/mytest, the /etc/ssh/sshd_config files will be written in ~/mytest/etc/ssh/ directory.

-stack-trace

Provides a full stack trace when exiting on error.

-backend

Specify a read/write backend. The actual backend name depends on the model passed to -model option. See Config::Model::AutoRead for details.

Embedding cme

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.

Logging

All Config::Model logging is now based on Log::Log4perl. Logging can be configured in the following files:

  •  ~/.log4config-model
  •  /etc/log4config-model.conf

Without these files, the following Log4perl config is used:

 log4perl.logger=WARN, Screen
 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 = %d %m %n

Log4perl uses the following categories:

Anything
Anything::Change

Trace change notification through configuration tree and instance.

Backend
Backend::Debian::Dpkg
Backend::Debian::Dpkg::Control
Backend::Debian::Dpkg::Copyright
Backend::Fstab
Backend::IniFile
Backend::PlainFile
Backend::ShellVar
Backend::Yaml
FuseUI
Instance
Loader
Model::Searcher
Tree::Element::CheckList
Tree::Element::Id
Tree::Element::Id::Hash
Tree::Element::Id::List
Tree::Element::Value
Tree::Element::Value::Dependency
Tree::Node
Tree::Node::Warped
ValueComputer
Warper
Wizard::Helper
Model

More categories will come.

SUPPORT

For support, please check the following resources:

FEEDBACKS

Feedback from users are highly desired. If you find this module useful, please share your use cases, success stories with the author or with the config-model- users mailing list.

AUTHOR

Dominique Dumont, ddumont at cpan dot org

SEE ALSO

Config::Model::Model, Config::Model::Instance, Config::Model::Node, Config::Model::HashId, Config::Model::ListId, Config::Model::WarpedNode, Config::Model::Value