config-edit(1) Edit data of configuration managed by Config::Model

SYNOPSIS


config-edit [options] ( -application popcon | -model Popcon ) [ ... ] [ commands ... ]

DESCRIPTION

"config-edit" program will use Config::Model configuration descriptions to validate or modify the configuration file of an application.

You can specify commands as arguments that will be run on the configuration root before launching the UI. These command follow the syntax defined in Config::Model::Loader.

"config-edit" can be run in several modes depending on your needs.

Graphical interface

  config-edit -application popcon

Provides a user interface so user can easily and securely modify the configuration of their system.

Curses interface

  config-edit -ui curses -application popcon

Provides a curses user interface

Shell like interface

  config-edit -ui shell -application popcon

Provides a shell like interface

upgrade mode

  config-edit -ui none -application popcon -save

Loads configuration date, perform validation and migration of old data (if specified by the model) and save the new configuration file.

Direct modification of configuration data

  config-edit -ui none -application popcon PARTICIPATE=yes

Loads old configuration data, update "PARTICIPATE" data, checks the modification and save the configuration back. Option "-save" is not needed as the data was modified by the command line.

Generation of configuration documentation

  config-edit -model Popcon -gen-pod [ output_dir ]

Generate pod documentation on STDOUT or write them in the specified directory. Note that one pod file will be created per class.

To get man pages or text docuement, you can pipe the output of the command:

 config-edit -model Popcon -doc  | pod2man > popcon-conf.3

Options

application
Application name to be configured. Specify "help" to get a list of available applications.
file
Configuration file name. Used only for models without standard configuration file name. (e.g. multistrap)
-model
Specifies the model used to edit configuration data. Specify "help" to get a list of available applications. This option is ignored when "- application" is specified
-ui
Specify the user interface type.
  • "tk": provides a Tk graphical interface (If Config::Model::TkUI is installed).
  • "curses": provides a curses user interface (If Config::Model::CursesUI is installed).
  • "shell": provides a shell like interface. See Config::Model::TermUI for details.
  • "fuse": provides an interface through 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>". (This is experimental. Mount point specification may change in the future)
  • "none": No UI provided. Only command line arguments are handled.
-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.
-instance-name
Specify an instance name. By default the instance name is copied from model name.
-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.
-config-file
Specify the configuration file to edit (which may override the file specified by the model).
 Note that some applicaitions (like multistrap) will require this option. For other models (like Debian::Dpkg), this option may not make sense as several files are used.
-verbose
Be (very) verbose
-debug
Provide debug infos.
-trace
Provides a full stack trace when exiting on error.
-force-load
Load file even if error are found in data. Bad data are discarded
-apply-fixes
Apply fixes mentioned in model description. For details, see "warn_if_match" or "warn_unless_match" in "" in Config::Model::Value. Configuration files will be saved if invoked with "-ui none" .
-backend
Specify a read/write backend. The actual backend name depends on the model passed to "-model" option. See Config::Model::AutoRead for details.
-dump [ file ]
Dump configuration content on STDOUT or in the specified with Config::Model syntax.

By default, dump only custom values, i.e. different from application built-in values or model default values. See -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)
-load <cds_file_to_load>
Load configuration data in model from cds file (using Config::Model serialisation format, typically done with -dump option). When this option is used, the usual configuration files will not be read.

If used with "-ui none", this option will load configuration data, validate it and save it in configuration file (if no error was found).

-save
Force re-writing the configuration. (useful for configuration upgrade)
-open-item 'path'
In graphical mode, force the UI to open the node specified. E.g.

 -open-item 'foo bar'
-fuse-dir
Directory where the FUSE virtual file system will be mounted (with "-ui fuse")

Search

You can search the configuration with the following options
-search
Specifies a string or pattern to search. "config-edit" 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.
-narrow-search
Narrows down the search to:
element
value
key
summary
Summary text
description
description text
help
value help text

Embedding config-edit

You can use config-edit from another program by using "-ui simple" option. This way you will be able to send command on the standard input of "config-edit" and get the results from the standard output.

Saving configuration data

Configuration data are saved only when :
  • Requested through the user interface
  • When commands are specified with arguments
  • When "-load" option is used
  • When "-save" option is used

You can run safely "config-edit -ui none" to test a configuration, configuration files will not be modified in this case.

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
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