Hello,

I'm not able to recreate the issue of augeas generating settings with
spaces in the output.  Here's how I tested it.  Can you provide a
counter example of using augeas such that it does generate a nagios.cfg
which includes the space before or after a variable?

# On my Xenial laptop
1. lxc launch ubuntu:trusty t1
2. lxc exec t1 /bin/bash

# as root in t1 trusty container
3. apt-get update && apt-get install augeas-lenses augeas-tools nagios3
4. nagios3 --verify-config /etc/nagios3/nagios.cfg   # returns OK, installed 
file does not include the spaces

# modify the config file to include spaces before and after and re-run 4
5.  nagios3 --verify-config /etc/nagios3/nagios.cfg 

Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Error in configuration file '/etc/nagios3/nagios.cfg' - Line 17 (UNKNOWN 
VARIABLE)
   Error processing main config file!


***> One or more problems was encountered while processing the config
files...

     Check your configuration file(s) to ensure that they contain valid
     directives and data defintions.  If you are upgrading from a previous
     version of Nagios, you should be aware that some variables/definitions
     may have been removed or modified in this version.  Make sure to read
     the HTML documentation regarding the config files, as well as the
     'Whats New' section to find out what has changed.

# setup temp area to test augeas out per 
# http://augeas.net/tour.html
6. export AUGEAS_ROOT=/tmp/augeas-sandbox
7. mkdir $AUGEAS_ROOT
8. sudo cp -pr /etc $AUGEAS_ROOT
9. sudo chown -R $(id -nu):$(id -ng) $AUGEAS_ROOT
10. augtool -b

# in the shell, make a change
augtool> print /files/etc/nagios3/nagios.cfg/cfg_file
/files/etc/nagios3/nagios.cfg/cfg_file = "/etc/nagios3/commands.cfg"
augtool> set /files/etc/nagios3/nagios.cfg/cfg_file 
/etc/nagios3/commands.cfg.local
augtool> print /files/etc/nagios3/nagios.cfg/cfg_file
/files/etc/nagios3/nagios.cfg/cfg_file = "/etc/nagios3/commands.cfg.local"
augtool> save
Saved 1 file(s)
augtool> 


11.  check the contents of nagios.cfg in the playground:
# diff -u nagios.cfg nagios.cfg.augsave 
--- nagios.cfg  2016-06-06 18:48:23.096279946 +0000
+++ nagios.cfg.augsave  2016-06-06 18:37:19.308822398 +0000
@@ -14,7 +14,7 @@
 log_file=/var/log/nagios3/nagios3.log
 
 # Commands definitions
-cfg_file=/etc/nagios3/commands.cfg.local
+cfg_file=/etc/nagios3/commands.cfg
 
 # Debian also defaults to using the check commands defined by the debian
 # nagios-plugins package


We can see the change but note that it's not injecting a space before or after 
the configuration variable.


** Changed in: augeas (Ubuntu)
       Status: New => Incomplete

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1491406

Title:
  augeas-lenses-1.2.0 - NagiosCfg lens broken for /etc/nagios.cfg due to
  spaces

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/augeas/+bug/1491406/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to