KEMBAR78
Cme: a tool to edit and validate configuration files | PDF
cme: Check or edit configuration files
Dominique Dumont
Debian Project
May 2018
Dominique Dumont cme: Check or edit configuration files
What is cme ?
A tool to check the semantic content or modify configuration files
content with:
a CLI
a shell
a curses interface
a GUI
Purpose:
help beginners discover application possibilities (online help)
handle migration of old configuration files
help package upgrade by merging user conf with upstream
changes (see lcdproc)
provide safe way to script configuration file modification
Dominique Dumont cme: Check or edit configuration files
Which configuration files ?
$ cme list
system ( system configuration files. Use sudo to run cme ):
approx
lcdproc
popcon
sshd
system-ssh
systemd
user ( user configuration files ):
ssh
systemd-user
application ( miscellaneous application configuration ):
dpkg
dpkg-control
dpkg-copyright
dpkg-patch
dpkg-patches
multistrap
systemd-service
systemd-socket
systemd-timer
Dominique Dumont cme: Check or edit configuration files
Validate semantic content
normal case
$ cme check lcdproc
cme: using LCDd model
loading data
checking data
check done
Dominique Dumont cme: Check or edit configuration files
Detect semantic error in value
file with a wrong value
ReportToSyslog = oui
error detection
$ cme check lcdproc
cme: using LCDd model
loading data
Configuration item ’server ReportToSyslog’
has a wrong value:
error: ’oui’ is not boolean,
i.e. not ’no’ or ’yes’
Dominique Dumont cme: Check or edit configuration files
Error correction with CLI 1/2
First try with cme modify:
$ sudo cme modify lcdproc 
’server ReportToSyslog=yes’
cme: using LCDd model
Configuration item ’server ReportToSyslog’
has a wrong value:
error: ’oui’ is not boolean,
i.e. not ’no’ or ’yes’
cme refuses to load a corrupted file
Dominique Dumont cme: Check or edit configuration files
Error correction with CLI 2/2
cme refuses to load a corrupted file, so use -force option:
$ sudo cme modify lcdproc 
’server ReportToSyslog=yes’ -force
cme: using LCDd model
Changes applied to lcdproc configuration:
- server ReportToSyslog: ’no’ -> ’yes’
Dominique Dumont cme: Check or edit configuration files
Warning detection
Some warnings can be be fixed by cme:
$ cme check dpkg
cme: using Dpkg model
loading data
Reading package lists... Done
Building dependency tree
Reading state information... Done
Warning in ’control source Standards-Version’ value ’4.1.3’: Current
standards version is ’4.1.4’. Please read https://www.[...]
Warning in ’control source Vcs-Browser’
value ’https://anonscm.debian.org/[...]’:
URL is not the canonical one for repositories hosted on
Debian infrastructure.
Warning in ’control source Vcs-Git’
value ’https://anonscm.debian.org/[...]’:
URL is not the canonical one for repositories hosted on
Debian infrastructure.
checking data
check done
you can try ’cme fix dpkg’ to fix the warnings shown above
Dominique Dumont cme: Check or edit configuration files
Warnng correction
Warning correction can be manual or automatic:
$ cme fix dpkg
cme: using Dpkg model
cme: running fix on dpkg configuration...
Reading package lists... Done
Building dependency tree
Reading state information... Done
[ ... same warnings ...]
Changes applied to dpkg configuration:
- control source Standards-Version has new value: ’4.1.4’
# applied fix for :Current standards version is ’4.1.4’.
Please read https://www.debian.org/doc/[...] for the changes
that may be needed on your package to upgrade it from
standard version ’4.1.3’ to ’4.1.4’.
- control source Vcs-Browser has new value: ’https://salsa.[...]’
# applied fix for :URL is not the canonical one for repositories
hosted on Debian infrastructure.
- control source Vcs-Git has new value: ’https://salsa.[...]’
# applied fix for :URL is not the canonical one for repositories
hosted on Debian infrastructure.
Dominique Dumont cme: Check or edit configuration files
cme script
cme scripts can be used for repetitive operations:
$ cme run <TAB> <TAB>
add-me-to-uploaders paste-license update-copyright
bump-dependency-version remove-uploader update-my-copyright-year
-list set-vcs-git
$ cme run update-my-copyright-year -doc
update my copyright year
only copyright of last year is updated
will commit with message:
’updated copyright year of Dominique Dumont’
$ cme run update-my-copyright-year
cme: using Dpkg::Copyright model
Changes applied to dpkg-copyright configuration:
- Files:"lib/*" Copyright: ’2013-2017, Dominique Dumont.’
-> ’2013-2018, Dominique Dumont.’
- Files:"script/*" Copyright: ’2013-2017, Dominique Dumont.’
-> ’2013-2018, Dominique Dumont.’
[master 1d03cd73] updated copyright year of Dominique Dumont
1 file changed, 3 insertions(+), 3 deletions(-)
Dominique Dumont cme: Check or edit configuration files
GUI examples
With ’sudo cme edit lcdproc’:
Dominique Dumont cme: Check or edit configuration files
Demo
... if I did not speak too much
Dominique Dumont cme: Check or edit configuration files
Next time: under the hood
During next presentation(s), we’ll see:
how these check and GUI are generated from a model
how to update a model (with cme meta edit)
what are the pro and cons of creating a cme model for a
project
how to create a cme script
next development steps for cme
Dominique Dumont cme: Check or edit configuration files
For more information
installation instructions
config-model wiki
config-model blog
http://wiki.debian.org/PackageConfigUpgrade
https://github.com/dod38fr/config-model/wiki/Managing-
Lcdproc-configuration-with-cme
Dominique Dumont cme: Check or edit configuration files

Cme: a tool to edit and validate configuration files

  • 1.
    cme: Check oredit configuration files Dominique Dumont Debian Project May 2018 Dominique Dumont cme: Check or edit configuration files
  • 2.
    What is cme? A tool to check the semantic content or modify configuration files content with: a CLI a shell a curses interface a GUI Purpose: help beginners discover application possibilities (online help) handle migration of old configuration files help package upgrade by merging user conf with upstream changes (see lcdproc) provide safe way to script configuration file modification Dominique Dumont cme: Check or edit configuration files
  • 3.
    Which configuration files? $ cme list system ( system configuration files. Use sudo to run cme ): approx lcdproc popcon sshd system-ssh systemd user ( user configuration files ): ssh systemd-user application ( miscellaneous application configuration ): dpkg dpkg-control dpkg-copyright dpkg-patch dpkg-patches multistrap systemd-service systemd-socket systemd-timer Dominique Dumont cme: Check or edit configuration files
  • 4.
    Validate semantic content normalcase $ cme check lcdproc cme: using LCDd model loading data checking data check done Dominique Dumont cme: Check or edit configuration files
  • 5.
    Detect semantic errorin value file with a wrong value ReportToSyslog = oui error detection $ cme check lcdproc cme: using LCDd model loading data Configuration item ’server ReportToSyslog’ has a wrong value: error: ’oui’ is not boolean, i.e. not ’no’ or ’yes’ Dominique Dumont cme: Check or edit configuration files
  • 6.
    Error correction withCLI 1/2 First try with cme modify: $ sudo cme modify lcdproc ’server ReportToSyslog=yes’ cme: using LCDd model Configuration item ’server ReportToSyslog’ has a wrong value: error: ’oui’ is not boolean, i.e. not ’no’ or ’yes’ cme refuses to load a corrupted file Dominique Dumont cme: Check or edit configuration files
  • 7.
    Error correction withCLI 2/2 cme refuses to load a corrupted file, so use -force option: $ sudo cme modify lcdproc ’server ReportToSyslog=yes’ -force cme: using LCDd model Changes applied to lcdproc configuration: - server ReportToSyslog: ’no’ -> ’yes’ Dominique Dumont cme: Check or edit configuration files
  • 8.
    Warning detection Some warningscan be be fixed by cme: $ cme check dpkg cme: using Dpkg model loading data Reading package lists... Done Building dependency tree Reading state information... Done Warning in ’control source Standards-Version’ value ’4.1.3’: Current standards version is ’4.1.4’. Please read https://www.[...] Warning in ’control source Vcs-Browser’ value ’https://anonscm.debian.org/[...]’: URL is not the canonical one for repositories hosted on Debian infrastructure. Warning in ’control source Vcs-Git’ value ’https://anonscm.debian.org/[...]’: URL is not the canonical one for repositories hosted on Debian infrastructure. checking data check done you can try ’cme fix dpkg’ to fix the warnings shown above Dominique Dumont cme: Check or edit configuration files
  • 9.
    Warnng correction Warning correctioncan be manual or automatic: $ cme fix dpkg cme: using Dpkg model cme: running fix on dpkg configuration... Reading package lists... Done Building dependency tree Reading state information... Done [ ... same warnings ...] Changes applied to dpkg configuration: - control source Standards-Version has new value: ’4.1.4’ # applied fix for :Current standards version is ’4.1.4’. Please read https://www.debian.org/doc/[...] for the changes that may be needed on your package to upgrade it from standard version ’4.1.3’ to ’4.1.4’. - control source Vcs-Browser has new value: ’https://salsa.[...]’ # applied fix for :URL is not the canonical one for repositories hosted on Debian infrastructure. - control source Vcs-Git has new value: ’https://salsa.[...]’ # applied fix for :URL is not the canonical one for repositories hosted on Debian infrastructure. Dominique Dumont cme: Check or edit configuration files
  • 10.
    cme script cme scriptscan be used for repetitive operations: $ cme run <TAB> <TAB> add-me-to-uploaders paste-license update-copyright bump-dependency-version remove-uploader update-my-copyright-year -list set-vcs-git $ cme run update-my-copyright-year -doc update my copyright year only copyright of last year is updated will commit with message: ’updated copyright year of Dominique Dumont’ $ cme run update-my-copyright-year cme: using Dpkg::Copyright model Changes applied to dpkg-copyright configuration: - Files:"lib/*" Copyright: ’2013-2017, Dominique Dumont.’ -> ’2013-2018, Dominique Dumont.’ - Files:"script/*" Copyright: ’2013-2017, Dominique Dumont.’ -> ’2013-2018, Dominique Dumont.’ [master 1d03cd73] updated copyright year of Dominique Dumont 1 file changed, 3 insertions(+), 3 deletions(-) Dominique Dumont cme: Check or edit configuration files
  • 11.
    GUI examples With ’sudocme edit lcdproc’: Dominique Dumont cme: Check or edit configuration files
  • 12.
    Demo ... if Idid not speak too much Dominique Dumont cme: Check or edit configuration files
  • 13.
    Next time: underthe hood During next presentation(s), we’ll see: how these check and GUI are generated from a model how to update a model (with cme meta edit) what are the pro and cons of creating a cme model for a project how to create a cme script next development steps for cme Dominique Dumont cme: Check or edit configuration files
  • 14.
    For more information installationinstructions config-model wiki config-model blog http://wiki.debian.org/PackageConfigUpgrade https://github.com/dod38fr/config-model/wiki/Managing- Lcdproc-configuration-with-cme Dominique Dumont cme: Check or edit configuration files