Git Product home page Git Product logo

augeas's Introduction

Build Status Fuzzing Status

Introduction

Augeas is a library and command line tool that focuses on the most basic problem in handling Linux configurations programmatically: editing actual configuration files in a controlled manner.

To that end, Augeas exposes a tree of all configuration settings (well, all the ones it knows about) and a simple local API for manipulating the tree. Augeas then modifies underlying configuration files according to the changes that have been made to the tree; it does as little modeling of configurations as possible, and focuses exclusively on transforming the tree-oriented syntax of its public API to the myriad syntaxes of individual configuration files.

This focus on editing sets Augeas apart from any other configuration tool I know of. Hopefully, Augeas will form a more solid foundation on which these tools can be built; with a clean, simple API these tools should be able to focus more on their core concerns and less on the mechanics of running sed, grep, awk, etc. to tweak a config file.

If all you need is a tool to edit configuration files, you only need to concern yourself with the handful of public API calls that Augeas exposes (or their equivalent language bindings). However, to teach Augeas about a new file format, you need to describe that file format in Augeas's domain specific language (a very small subset of ML) Documentation for that language can be found on the Augeas website at http://augeas.net/ If you do that, please contribute the description if at all possible, or include it in the distribution of your software - all you need to do for that is add a couple of text files, there is no need to change existing code. Ultimately, Augeas should describe all config files commonly found on a Linux system.

Non-goals

Augeas is as much defined by the things it does not try to accomplish as by its goals:

  • No abstraction from native config format, i.e. the organization of the tree mirrors closely how the native config files are organized
  • No cross-platform abstraction - what is logically the same value may live in different places in the tree on different distributions. Dealing with that should be left to a higher-level tool
  • No remote management support. Augeas is a local API, other ways of access to Augeas should be built on top of it
  • No (or very little) modelling. Augeas is focused on syntax transformation, not on any higher-level understanding of configuration.

The above non-goals are of course important concerns in practice. Historically though, too many config mgmt projects have failed because they set their sights too high and tried to address syntax transformation, modelling, remote support, and scalable management all in one. That leads to a lack of focus, and to addressing each of those goals unsatisfactorily.

Building

These instructions apply to building a released tarball. If you want to build from a git checkout, see the file HACKING.

See the generic instructions in INSTALL. Generally,

  ./configure
  make && make install

should be all that is needed.

You need to have readline-devel installed. On systems that support SELinux, you should also install libselinux-devel.

Documentation

Documentation can be found on Augeas' website http://augeas.net/ The site also contains information on how to get in touch, what you can do to help etc.

License

Augeas is released under the Lesser General Public License, Version 2.1 See the file COPYING for details.

augeas's People

Contributors

afb avatar akissa avatar bodgit avatar brianredbeard avatar domcleal avatar dtrebbien avatar erinn avatar fmaillard avatar georgehansper avatar giraldeau avatar james-antill avatar jasperla avatar jcpunk avatar jtopjian avatar kamichael avatar kunkku avatar lmctv avatar lutter avatar mchf avatar mdbooth avatar mlichvar avatar mpalmer avatar ptoscano avatar raphink avatar rfdrake avatar rwmjones avatar spredzy avatar storagemctesty avatar thedrow avatar wfp5p avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

augeas's Issues

RPMs in EPEL is outdated

EPEL is official repository for RHEL-based distributes. It's mentioned here.

But version of Augeas is outdated there ( Current release is 1.1.0, latest RPM is 0.9.0).

Can't configure /etc/cups/cups-pdf.conf

Hi,

I tried to change values in /etc/cups/cups-pdf.conf (configuration file of the PDF printer of the cups printing system) with augtool. I want to change lines like

Label 0

or

Label 0

into

Label 1

which augtool fails to do. A major reason seems to be that augtool does not list that as

/files/etc/cups/cups-pdf.conf/Label

but as

comment[74] = Label 0

or
directive[2]/ = Label

which does not allow to use a simple command like

set /files/etc/cups/cups-pdf.conf/Label 1
or
set /files/etc/cups/cups-pdf.conf/directive[.=Label] 1

regards
Hadmut

Parsing issue with Shellvars.lns

Hello,

This kind of line isn't handled by this lens :

tmppid=`grep 'lock_file=' $CFG | grep -v '#' | tail -n 1 | awk -F '=' '{print $2}'`

I got :

/augeas/files/etc/default/toto/error/lens = "/usr/share/augeas/lenses/dist/shellvars.aug:138.12-.89:"
/augeas/files/etc/default/toto/error/message = "Syntax error"

Regards

Olivier

make idempotent changes easy with augtool

as discussed in (4) in http://www.redhat.com/archives/augeas-devel/2010-January/msg00100.html:

Using augtool from scripts really requires a significant wrapper to handle the frequent use case of idempotently adding a line:

  • add a node (subtree) if it doesn't exist
  • do nothing if it exists with the same values as set
  • if an exiting node exists with deviating values complain and abort or, if requested, set the values to the desired state.
  • handle errors reliably

.. to really support idempotent changes, augtool will need to support an if statement; in general, you will make multiple changes if something in the tree isn't what you expect (e.g., if there's no entry in /etc/hosts for 192.168.0.1, you'll want to add several nodes)

I am thinking of a syntax like
if PATHEXPR then
.. statements (one per line) ..
else
.. statements ..
end

As a result, this syntax should allow changes like:

  • adding an alias to /etc/hosts for a specific ip-address only if it does not exist for this node
  • if the alias in the example above exists for another node, the alias can be either deleted for the other node, or an error be thrown (exit > 0)
  • insert following line into pg_hba.conf if it does not exist
    host all postgres 127.0.0.1/32 ident
  • choose either to throw an error or to update an existing line that matches
    host all postgres 127.0.0.1/32

I would be willing to offer some $ on bountysource - someone interested to join?

will not parse my.cnf if any !include directives are present

In 0.9.0, my my.cnf parses fine. With 1.0.0 or newer, it does not. If I take out the !include /sub/path.d/ directive, it works, but obviously I need that in there. I saw in the changelog that something changed regarding !include directives, but it appears to have broken this functionality and is locking me into 0.9.0.

Redis.conf empty string value

[root@server dist]# puppet agent -t
Info: Retrieving plugin
Info: Loading facts in /var/lib/puppet/lib/facter/root_home.rb
Info: Loading facts in /var/lib/puppet/lib/facter/pe_version.rb
Info: Loading facts in /var/lib/puppet/lib/facter/facter_dot_d.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppet_vardir.rb
Info: Caching catalog for server
Info: Applying configuration version '1397520532'
Warning: Augeasredis_remove_bind_localhost: Loading failed for one or more files, see debug for /augeas//error output
Error: /Stage[main]/Redis/Augeas[redis_remove_bind_localhost]: Could not evaluate: Save failed with return code false, see debug
Notice: Finished catalog run in 0.24 seconds

[root@server dist]# augtool print /augeas//error
/augeas/files/etc/iproute2/rt_protos/error = "parse_failed"
/augeas/files/etc/iproute2/rt_protos/error/pos = "176"
/augeas/files/etc/iproute2/rt_protos/error/line = "22"
/augeas/files/etc/iproute2/rt_protos/error/char = "0"
/augeas/files/etc/iproute2/rt_protos/error/lens = "/usr/share/augeas/lenses/dist/iproute2.aug:7.12-.47:"
/augeas/files/etc/iproute2/rt_protos/error/message = "Iterated lens matched less than it should"
/augeas/files/etc/iproute2/rt_dsfield/error = "parse_failed"
/augeas/files/etc/iproute2/rt_dsfield/error/pos = "0"
/augeas/files/etc/iproute2/rt_dsfield/error/line = "1"
/augeas/files/etc/iproute2/rt_dsfield/error/char = "0"
/augeas/files/etc/iproute2/rt_dsfield/error/lens = "/usr/share/augeas/lenses/dist/iproute2.aug:7.12-.47:"
/augeas/files/etc/iproute2/rt_dsfield/error/message = "Iterated lens matched less than it should"
/augeas/files/etc/redis/redis.conf/error = "parse_failed"
/augeas/files/etc/redis/redis.conf/error/pos = "24258"
/augeas/files/etc/redis/redis.conf/error/line = "578"
/augeas/files/etc/redis/redis.conf/error/char = "0"
/augeas/files/etc/redis/redis.conf/error/lens = "/usr/share/augeas/lenses/dist/redis.aug:112.10-.37:"
/augeas/files/etc/redis/redis.conf/error/message = "Iterated lens matched less than it should"

Line 578: notify-keyspace-events ""
After commenting this line augeas works fine.

Problem with square bracket escaping and matching in path expressions

There appears to be a problem with square brackets being used in string literals for matching. I found this example trying to match on /etc/inputrc, for this:

Notice this entry:

augtool> match /files/etc/inputrc/@if/entry[position() = 3]
/files/etc/inputrc/@if/entry[3] = \e[5~

It does not get matched by this expression:

augtool> match /files/etc/inputrc/@if/entry[. = '\\e\[5~']
  (no matches)

But it can be matched using an equivalent regular expression:

augtool> match /files/etc/inputrc/@if/entry[. =~ regexp("^\\\\e\[5~$")]
/files/etc/inputrc/@if/entry[3] = \e[5~

If there is no square bracket to escape, then matching works:

augtool> match /files/etc/inputrc/@if/entry[. = '\\eOc']
/files/etc/inputrc/@if/entry[12] = \eOc

You must escape the square bracket inside the string or else you get an "unmatched [" error. Using \[ does not match either (not that I would expect it to).

Master branch doesn't compile

Using commit 361adbf

Attempting to compile gives the following error

make[3]: Entering directory `/tmp/augeas/gnulib/lib'
make[4]: Entering directory `/tmp/augeas/gnulib/lib'
  CC     localcharset.lo
  CC     malloca.lo
  CC     safe-alloc.lo
  CC     strnlen1.lo
  CC     tempname.lo
  CC     asnprintf.lo
  CC     fnmatch.lo
  CC     getfilecon.lo
  CC     getopt.lo
  CC     getopt1.lo
  CC     printf-args.lo
  CC     printf-parse.lo
  CC     strstr.lo
  CC     vasnprintf.lo
  CCLD   libgnu.la
  GEN    charset.alias
  GEN    ref-add.sed
  GEN    ref-del.sed
make[4]: Leaving directory `/tmp/augeas/gnulib/lib'
make[3]: Leaving directory `/tmp/augeas/gnulib/lib'
make[2]: Leaving directory `/tmp/augeas/gnulib/lib'
Making all in src
make[2]: Entering directory `/tmp/augeas/src'
echo '#define DATADIR "/usr/local/share"' > datadir.h1
../build/aux/move-if-change datadir.h1 datadir.h
make  all-am
make[3]: Entering directory `/tmp/augeas/src'
  CC     fa.lo
  CC     hash.lo
  CC     memory.lo
  CC     ref.lo
  CCLD   libfa.la
  CC     augeas.lo
  CC     augrun.lo
  CC     pathx.lo
  CC     internal.lo
  CC     syntax.lo
  YACC   parser.c
byacc: e - line 46 of "/tmp/augeas/src/parser.y", syntax error
%code provides {
^
make[3]: *** [parser.c] Error 1
make[3]: Leaving directory `/tmp/augeas/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/augeas/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/augeas'
make: *** [all] Error 2

Attempting to compile on CentOS 6.4

sshd lense usage inconsistency with MACs

Hi,

lets say i want to configure the following within my sshd_config

Ciphers [email protected],[email protected],aes256-ctr,aes128-ctr
KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1
MACs [email protected],hmac-sha2-512,mac-sha2-256,hmac-ripemd160

You see, very identical types of data using key and a comma separated list of values. In the sshd lense you can configure Cipers and KexAlgortihms making one single value containing the comma separated list as a string. But not MACs. The point is why?!

this follows as the result... looks pretty inconsistent, right?

  augeas { "sshd_config":
    context => "/files/etc/ssh/sshd_config",
    changes => [
      "set PermitRootLogin no",
      "set DenyUsers/1 ubuntu",
      "set Ciphers [email protected],[email protected],aes256-ctr,aes128-ctr",
      "set KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1",
      "set MACs/1    [email protected]",
      "set MACs/2    hmac-sha2-512",
      "set MACs/3    mac-sha2-256",
      "set MACs/4    hmac-ripemd160",
    ],
  }

Did some investigation in git log / blame and found this commit @d9122b074f28674118499f0bcf0b5055ef696194 from 2008 ... just wanted to be sure there isnt a non-trivial reason for this behavior.

I can also make a pull request if you tell me the way you like to have it. Speaking converting MAC to single-string or Ciphers and Kex to separated items.

Greetings,
Florian

Can not parse default /lib/systemd/system/fence_virtd.service

Version-Release number of selected component (if applicable):
augeas-1.1.0-12.el7

How to reproduce

  1. Install package: fence-virtd-0.3.0-16.el7
  2. Run command: echo 'print /augeas//error'|augtool

echo 'print /augeas//error'|augtool

/augeas/files/lib/systemd/system/fence_virtd.service/error = "parse_failed"
/augeas/files/lib/systemd/system/fence_virtd.service/error/pos = "250"
/augeas/files/lib/systemd/system/fence_virtd.service/error/line = "13"
/augeas/files/lib/systemd/system/fence_virtd.service/error/char = "0"
/augeas/files/lib/systemd/system/fence_virtd.service/error/lens = "/usr/share/augeas/lenses/dist/inifile.aug:497.25-.43:"
/augeas/files/lib/systemd/system/fence_virtd.service/error/message = "Get did not match entire input"

Actual results:
Parse failed

Expected results:
No errors like: /augeas/files/lib/systemd/system/fence_virtd.service

Additional info:

#cat /lib/systemd/system/fence_virtd.service
[Unit]
Description=Fence-Virt system host daemon
After=network.target libvirt-qmf.service libvirtd.service corosync.service
Requires=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=forking
Restart=on-failure
SysVStartPriority=99
Environment="FENCE_VIRTD_ARGS=-w"
\# Autogenerated below here
EnvironmentFile=-/etc/sysconfig/fence_virtd
ExecStart=/usr/sbin/fence_virtd $FENCE_VIRTD_ARGS

Can not parse default /etc/httpd/conf.d/mod_security.conf

Version-Release number of selected component (if applicable):
augeas-1.1.0-12.el7

How to reproduce

  1. Install package: mod_security-2.7.3-4.el7.x86_64
  2. Run command: echo 'print /augeas//error'|augtool

echo 'print /augeas//error'|augtool

/augeas/files/etc/httpd/conf.d/mod_security.conf/error = "parse_failed"
/augeas/files/etc/httpd/conf.d/mod_security.conf/error/pos = "770"
/augeas/files/etc/httpd/conf.d/mod_security.conf/error/line = "18"
/augeas/files/etc/httpd/conf.d/mod_security.conf/error/char = "4"
/augeas/files/etc/httpd/conf.d/mod_security.conf/error/lens = "/usr/share/augeas/lenses/dist/httpd.aug:88.10-.44:"
/augeas/files/etc/httpd/conf.d/mod_security.conf/error/message = "Syntax error"

Actual results:
Parse failed

Expected results:
No errors like: /augeas/files/etc/httpd/conf.d/mod_security.conf

Additional info:

#cat /etc/httpd/conf.d/mod_security.conf 
<IfModule mod_security2.c>
    # ModSecurity Core Rules Set configuration
    IncludeOptional modsecurity.d/*.conf
    IncludeOptional modsecurity.d/activated_rules/*.conf
    
    # Default recommended configuration
    SecRuleEngine On
    SecRequestBodyAccess On
    SecRule REQUEST_HEADERS:Content-Type "text/xml" \
         "id:'200000',phase:1,t:none,t:lowercase,pass,nolog,ctl:requestBodyProcessor=XML"
    SecRequestBodyLimit 13107200
    SecRequestBodyNoFilesLimit 131072
    SecRequestBodyInMemoryLimit 131072
    SecRequestBodyLimitAction Reject
    SecRule REQBODY_ERROR "!@eq 0" \
    "id:'200001', phase:2,t:none,log,deny,status:400,msg:'Failed to parse request body.',logdata:'%{reqbody_error_msg}',severity:2"
    SecRule MULTIPART_STRICT_ERROR "!@eq 0" \
    "id:'200002',phase:2,t:none,log,deny,status:44,msg:'Multipart request body \
    failed strict validation: \
    PE %{REQBODY_PROCESSOR_ERROR}, \
    BQ %{MULTIPART_BOUNDARY_QUOTED}, \
    BW %{MULTIPART_BOUNDARY_WHITESPACE}, \
    DB %{MULTIPART_DATA_BEFORE}, \
    DA %{MULTIPART_DATA_AFTER}, \
    HF %{MULTIPART_HEADER_FOLDING}, \
    LF %{MULTIPART_LF_LINE}, \
    SM %{MULTIPART_MISSING_SEMICOLON}, \
    IQ %{MULTIPART_INVALID_QUOTING}, \
    IP %{MULTIPART_INVALID_PART}, \
    IH %{MULTIPART_INVALID_HEADER_FOLDING}, \
    FL %{MULTIPART_FILE_LIMIT_EXCEEDED}'"

    SecRule MULTIPART_UNMATCHED_BOUNDARY "!@eq 0" \
    "id:'200003',phase:2,t:none,log,deny,status:44,msg:'Multipart parser detected a possible unmatched boundary.'"

    SecPcreMatchLimit 1000
    SecPcreMatchLimitRecursion 1000

    SecRule TX:/^MSC_/ "!@streq 0" \
            "id:'200004',phase:2,t:none,deny,msg:'ModSecurity internal error flagged: %{MATCHED_VAR_NAME}'"

    SecResponseBodyAccess Off
    SecDebugLog /var/log/httpd/modsec_debug.log
    SecDebugLogLevel 0
    SecAuditEngine RelevantOnly
    SecAuditLogRelevantStatus "^(?:5|4(?!04))"
    SecAuditLogParts ABIJDEFHZ
    SecAuditLogType Serial
    SecAuditLog /var/log/httpd/modsec_audit.log
    SecArgumentSeparator &
    SecCookieFormat 0
    SecTmpDir /var/lib/mod_security
    SecDataDir /var/lib/mod_security
</IfModule>

Shellvars_list lens does not handle backticks

The Shellvars_list does not handle backticks. For example the lens will fail on the following:

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

If you have a backtick do you store it as a single value or as a list?

(dhcpd.aug / augeas) Support for structures like if conditions

augtool version: 0.10.0

Using the following configuration for dhcpd.conf including a condition:

if exists dhcp-parameter-request-list {
}

It is not possible for augeas(/augtool) to parse this text to a tree because it includes a condition.

Unit test for testing against dhcpd.aug:

module Test_dhcpd =

let lns = Dhcpd.lns

let conf = "if exists dhcp-parameter-request-list {
}
"

test lns get conf = ?

Test result:

augparse /usr/share/augeas/lenses/dist/dhcpd.aug && augparse -I. test_dhcpd.aug
test_dhcpd.aug:9.0-.21:exception thrown in test
test_dhcpd.aug:9.5-.17:exception: Syntax error
    Lens: /usr/share/augeas/lenses/dist/dhcpd.aug:396.10-.24:
    Error encountered at 1:0 (0 characters into string)
                               <|=|if exists dhcp-parameter-req>

    Tree generated so far:


Syntax error in lens definition
Failed to load test_dhcpd.aug

The parse error prevents any use of augeas on the configuration file.
Structures like this are sometimes very important for correct operation so direct support for them should be implemented in augeas.

augtool: unable to clear multiple values at once

augtool command clear is unable to clear several matching elements at once.

For example: Tying to remove all hosts entries except of localhost:
ยดยดยด
augtool> clear /files/etc/hosts/*[./ipaddr != '127.0.0.1']
error: Too many matches for path expression
ยดยดยด

Can not parse default /etc/default/rmt

Version-Release number of selected component (if applicable):
augeas-1.1.0-12.el7

How to reproduce

  1. Install package: rmt-1.5.2-11.el7
  2. Run command: echo 'print /augeas//error'|augtool

echo 'print /augeas//error'|augtool

/augeas/files/etc/default/rmt/error = "parse_failed"
/augeas/files/etc/default/rmt/error/pos = "1554"
/augeas/files/etc/default/rmt/error/line = "52"
/augeas/files/etc/default/rmt/error/char = "6"
/augeas/files/etc/default/rmt/error/lens = "/usr/share/augeas/lenses/dist/shellvars.aug:180.12-.56:"
/augeas/files/etc/default/rmt/error/message = "Syntax error"

Actual results:
Parse failed

Expected results:
No errors like: /augeas/files/etc/default/rmt

Additional info:

$ cat /etc/default/rmt
#ident @(#)rmt.dfl  1.2 05/08/09 Copyr 2000 J. Schilling
#
# This file is /etc/default/rmt
#
# NOTE: If this file is not present, rmt will reject to work for root.
#
# If no USER= entry is present, nobody is allowed to run rmt.
# If no ACCESS= entry is present, no device may to be used by remote users.

# 
# The file where debug info should go to.
# If you don't like debugging (e.g. for speed) comment out
# the this line.
#
#DEBUG=/tmp/RMT

#
# Each USER= entry adds the listed user to the users who may run rmt
#
# A typical passwd entry looks like this:
# rtape:x:1999:1000:Remote TAPE:/export/home/rtape:/opt/schily/sbin/rmt
#
# Add entries for all valid remote users to /export/home/rtape/.rhosts
#
#USER=rtape
#USER=joerg
# Default to old SunOS behavior. If you like to be more restrictive, comment
# out the entry below and enable the explicit USER= entries above.
USER=*

#
# Each ACCESS= entry adds a target or group of targets to the list of visible
# targets for all users that do remote tape/file access from a specific host.
#
#   Username is the name of the user that runs rmt. If you create
#   different users, you may assign different permissions to different
#   users from the same host.
#
#   Hostname must be in the same notation as needed for .rhosts (e.g. in
#   the way you will be listed by 'who' if you log in from this host).
#
#   local   remote
#   user    host    file
#   name    name
#
#ACCESS=rtape   sparky  /dev/rmt/*
#ACCESS=*   *   /dev/rmt/*
#ACCESS=*   *   /dev/null
#ACCESS=*   *   /dev/zero

# Historically, Red Hat rmt was not so ^^ restrictive.
ACCESS=*    *   *

Properties lens doesn't like multi-line where first line has no value (1.0.0-5.el6_5.1)

If you try to parse the following properties file.

tomcat.util.scan.DefaultJarScanner.jarsToSkip= \
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar

it fails with the following error

augtool> set /augeas/load/Properties/lens Properties.lns
augtool> set /augeas/load/Properties/incl[last()+1] /tmp/test.properties
augtool> load
augtool> print /augeas//error
/augeas/files/tmp/test.properties/error = "parse_failed"
/augeas/files/tmp/test.properties/error/pos = "0"
/augeas/files/tmp/test.properties/error/line = "1"
/augeas/files/tmp/test.properties/error/char = "0"
/augeas/files/tmp/test.properties/error/lens = "/usr/share/augeas/lenses/dist/properties.aug:47.25-.100:"
/augeas/files/tmp/test.properties/error/message = "Iterated lens matched less than it should"

Changing the file to

tomcat.util.scan.DefaultJarScanner.jarsToSkip= bootstrap.jar,commons-daemon.jar,tomcat-juli.jar,\
annotations-api.jar,el-api.jar,jsp-api.jar,servlet-api.jar,\
catalina.jar,catalina-ant.jar,catalina-ha.jar,catalina-tribes.jar

Works as expected

augtool> set /augeas/load/Properties/lens Properties.lns
augtool> set /augeas/load/Properties/incl[last()+1] /tmp/test.properties
augtool> load
augtool> print /files/tmp/test.properties/
/files/tmp/test.properties
/files/tmp/test.properties/tomcat.util.scan.DefaultJarScanner.jarsToSkip = " < multi > "

Recursive seq nodes numbered upside-down

When using seq in a recursive lens, the nodes are numbered from the deepest levels to the highest ones. Example:

module Inverted =
let rec inverted = [ seq "inverted" . store "a" . inverted? ]
test inverted get "aaa" = ?


$ augparse inverted.aug 
Test result: inverted.aug:5.0-.27:
  { "3" = "a"
    { "2" = "a"
      { "1" = "a" }
    }
  }

To avoid this, it should be possible to link the counter to a given level and avoid it spreading through sublevels of recursion.

FreeBSD 10+ && syslog.aug

FreeBSD 10.0 will ship with a syslog.conf that has:

...
cron.*                      /var/log/cron
!-devd
*.=debug                    /var/log/debug.log
...
# Uncomment this if you wish to see messages produced by devd
# !devd
# *.>=info                                       /var/log/devd.log
...

The line "# !devd" makes the parser fail because "#!" is special, and, well "# !" is not.

sshd Match Address *,!10.0.0.0/24 strangeness

I've updated test_sshd to be like this https://gist.github.com/jasperla/8557047

However it fails as such:

FAIL: lens-sshd.sh
Syntax error in lens definition
Failed to load /usr/obj/ports/augeas-1.1.0/augeas-1.1.0/lenses/tests/test_sshd.aug
/usr/obj/ports/augeas-1.1.0/augeas-1.1.0/lenses/tests/test_sshd.aug:67.2-97.54:exception thrown in test
/usr/obj/ports/augeas-1.1.0/augeas-1.1.0/lenses/tests/test_sshd.aug:67.7-.32:exception: Get did not match entire input
    Lens: /usr/obj/ports/augeas-1.1.0/augeas-1.1.0/lenses/sshd.aug:125.12-127.36:
    Error encountered at 16:0 (325 characters into string)
    <0.0.0/24\n  X11Forwarding no\n|=|  AllowGroups users\n  ForceC>

    Tree generated so far:
    /X11Forwarding = "yes"
/Match[1]
/Match[1]/Condition
/Match[1]/Condition/User = "sarko"
/Match[1]/Condition/Group = "pres.*"
/Match[1]/Settings
/Match[1]/Settings/Banner = "/etc/bienvenue.txt"
/Match[1]/Settings/X11Forwarding = "no"
/Match[2]
/Match[2]/Condition
/Match[2]/Condition/Address = "10.0.0.1"
/Match[2]/Settings
/Match[2]/Settings/X11Forwarding = "no"
/Match[2]/Settings/PermitTTY = "no"
/Match[3]
/Match[3]/Condition
/Match[3]/Condition/Address = "*"
/Match[3]/Settings
/Match[3]/Settings/X11Forwarding = "no"
/Match[4]
/Match[4]/Condition
/Match[4]/Condition/Address = "10.0.0.0/24"
/Match[4]/Settings
/Match[4]/Settings/X11Forwarding = "no"
/Match[5]
/Match[5]/Condition
/Match[5]/Condition/Address = "*,!10.0.0.2"
/Match[5]/Settings
/Match[5]/Settings/X11Forwarding = "no"
/Match[6]
/Match[6]/Condition
/Match[6]/Condition/Address = "*,!10.0.0.0/24"
/Match[6]/Settings
/Match[6]/Settings/X11Forwarding = "no"

It seems that for some reason it fails to recognize the second entry for Settings. A block such as

Match Address *,!10.0.0.0/24
  X11Forwarding no
  AllowGroups users
  ForceCommand internal-sftp
  ChrootDirectory /chroot

is perfectly valid and accepted by OpenSSH.

PAM lens: order matters - enable 'ins'?

We all know, order matters in the /etc/pam.d/* files.

Currently, Augeas will read a file like this:

/files/etc/pam.d/sshd/6/module = "pam_env.so"

As far as I understand, it is not possible to insert a record before the record where /module = "pam_env.so" using the ins command.

As a fix, I would suggest changing seq to label in line 58 of pam.aug, i.e.

let record_svc = [ label "record" . indent . record ]

XML prolog with single quotes

I've got a syntax error on Ubuntu 12.04 when tried to parse Tomcat 7 server.xml file. It uses single quotes in XML prolog

<?xml version='1.0' encoding='utf-8'?>

XML spec allows both single and double quotes in XML prolog
http://www.w3.org/TR/REC-xml/#NT-VersionInfo

I will be glad to come with a pull request, but i haven't any experience with lenses grammar.

logrotate cannot save, "Failed to match"

When trying to add a "file" to /etc/logrotate.d/rsyslog I get a, "Failed to match" error when saving. This happens with augeas version 0.10.0 (shipping with Ubuntu precise) and version 1.2.0. Here's an example with augeas version 1.2.0 on Ubuntu 12.04 LTS.

jlewis@ops02:~/tmp/augeas-1.2.0/src$ ./augtool --version
augtool 1.2.0 <http://augeas.net/>
Copyright (C) 2007-2011 David Lutterkort
License LGPLv2+: GNU LGPL version 2.1 or later
                 <http://www.gnu.org/licenses/lgpl-2.1.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David Lutterkort

jlewis@ops02:~/tmp/augeas-1.2.0/src$ sudo ./augtool -I ../lenses

augtool> print /files/etc/logrotate.d/rsyslog/*[rotate = '4']
/files/etc/logrotate.d/rsyslog/rule[2]
/files/etc/logrotate.d/rsyslog/rule[2]/file[1] = "/var/log/mail.info"
/files/etc/logrotate.d/rsyslog/rule[2]/file[2] = "/var/log/mail.warn"
/files/etc/logrotate.d/rsyslog/rule[2]/file[3] = "/var/log/mail.err"
/files/etc/logrotate.d/rsyslog/rule[2]/file[4] = "/var/log/mail.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[5] = "/var/log/daemon.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[6] = "/var/log/kern.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[7] = "/var/log/auth.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[8] = "/var/log/user.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[9] = "/var/log/lpr.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[10] = "/var/log/cron.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[11] = "/var/log/debug"
/files/etc/logrotate.d/rsyslog/rule[2]/file[12] = "/var/log/messages"
/files/etc/logrotate.d/rsyslog/rule[2]/rotate = "4"
/files/etc/logrotate.d/rsyslog/rule[2]/schedule = "weekly"
/files/etc/logrotate.d/rsyslog/rule[2]/missingok = "missingok"
/files/etc/logrotate.d/rsyslog/rule[2]/ifempty = "notifempty"
/files/etc/logrotate.d/rsyslog/rule[2]/compress = "compress"
/files/etc/logrotate.d/rsyslog/rule[2]/delaycompress = "delaycompress"
/files/etc/logrotate.d/rsyslog/rule[2]/sharedscripts = "sharedscripts"
/files/etc/logrotate.d/rsyslog/rule[2]/postrotate = "\t\treload rsyslog >/dev/null 2>&1 || true"

augtool> set /files/etc/logrotate.d/rsyslog/*[rotate = '4']/file[. = '/var/log/jlewis2.log'] /var/log/jlewis2.log

augtool> print /files/etc/logrotate.d/rsyslog/*[rotate = '4']
/files/etc/logrotate.d/rsyslog/rule[2]
/files/etc/logrotate.d/rsyslog/rule[2]/file[1] = "/var/log/mail.info"
/files/etc/logrotate.d/rsyslog/rule[2]/file[2] = "/var/log/mail.warn"
/files/etc/logrotate.d/rsyslog/rule[2]/file[3] = "/var/log/mail.err"
/files/etc/logrotate.d/rsyslog/rule[2]/file[4] = "/var/log/mail.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[5] = "/var/log/daemon.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[6] = "/var/log/kern.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[7] = "/var/log/auth.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[8] = "/var/log/user.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[9] = "/var/log/lpr.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[10] = "/var/log/cron.log"
/files/etc/logrotate.d/rsyslog/rule[2]/file[11] = "/var/log/debug"
/files/etc/logrotate.d/rsyslog/rule[2]/file[12] = "/var/log/messages"
/files/etc/logrotate.d/rsyslog/rule[2]/rotate = "4"
/files/etc/logrotate.d/rsyslog/rule[2]/schedule = "weekly"
/files/etc/logrotate.d/rsyslog/rule[2]/missingok = "missingok"
/files/etc/logrotate.d/rsyslog/rule[2]/ifempty = "notifempty"
/files/etc/logrotate.d/rsyslog/rule[2]/compress = "compress"
/files/etc/logrotate.d/rsyslog/rule[2]/delaycompress = "delaycompress"
/files/etc/logrotate.d/rsyslog/rule[2]/sharedscripts = "sharedscripts"
/files/etc/logrotate.d/rsyslog/rule[2]/postrotate = "\t\treload rsyslog >/dev/null 2>&1 || true"
/files/etc/logrotate.d/rsyslog/rule[2]/file[13] = "/var/log/jlewis2.log"

augtool> save
error: Failed to execute command
saving failed (run 'print /augeas//error' for details)
augtool> 
augtool> print /augeas/files/etc/logrotate.d/rsyslog/error
/augeas/files/etc/logrotate.d/rsyslog/error = "put_failed"
/augeas/files/etc/logrotate.d/rsyslog/error/path = "/files/etc/logrotate.d/rsyslog/rule"
/augeas/files/etc/logrotate.d/rsyslog/error/lens = "../lenses/logrotate.aug:115.7-.58:"
/augeas/files/etc/logrotate.d/rsyslog/error/message = "Failed to match \n    { /file/ = /\\/[^\\001-\\004\\t\\n #,={}]+/ }({ /file/ = /\\/[^\\001-\\004\\t\\n #,={}]+/ })*(({ /schedule/ = /daily|weekly|monthly|yearly/ } | { /rotate/ = /[+-]?[0-9]+/ } | { /create/ } | { /nocreate/ } | { /su/ } | { /include/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /missingok/ = /(no)?missingok/ } | { /compress/ = /(no)?compress/ } | { /delaycompress/ = /(no)?delaycompress/ } | { /ifempty/ = /(not)?ifempty/ } | { /sharedscripts/ = /(no)?sharedscripts/ } | { /size/ = /[+-]?[0-9]+[GMk]?/ } | { /tabooext/ = /((\\\\+))?/ } | { /olddir/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /noolddir/ } | { /mail/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /mailfirst/ } | { /maillast/ } | { /nomail/ } | { /errors/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /extension/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /dateext/ = /(no)?dateext/ } | { /compresscmd/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /uncompresscmd/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /compressext/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /compressoptions/ } | { /copy/ = /(no)?copy/ } | { /copytruncate/ = /(no)?copytruncate/ } | { /maxage/ = /[+-]?[0-9]+/ } | { /minsize/ = /[+-]?[0-9]+[GMk]?/ } | { /shred/ = /(no)?shred/ } | { /shredcycles/ = /[+-]?[0-9]+/ } | { /start/ = /[+-]?[0-9]+/ } | { /(pre|post)rotate|(first|last)action/ = /((((([\\t ][\\t ]*e|e)ndscript[\\t ][\\t ]*[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscript[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscrip([^\\001-\\004\\nt][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscri([^\\001-\\004\\np][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscr([^\\001-\\004\\ni][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndsc([^\\001-\\004\\nr][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nds([^\\001-\\004\\nc][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nd([^\\001-\\004\\ns][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)n([^\\001-\\004\\nd][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)([^\\001-\\004\\nn][^\\001-\\004\\n]*|)|[\\t ][\\t ]*([^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|)|[^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|)(\\n(([\\t ][\\t ]*e|e)ndscript[\\t ][\\t ]*[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscript[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscrip([^\\001-\\004\\nt][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscri([^\\001-\\004\\np][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscr([^\\001-\\004\\ni][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndsc([^\\001-\\004\\nr][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nds([^\\001-\\004\\nc][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nd([^\\001-\\004\\ns][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)n([^\\001-\\004\\nd][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)([^\\001-\\004\\nn][^\\001-\\004\\n]*|)|[\\t ][\\t ]*([^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|)|[^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|))*)?))?/ } | { /#comment/ = /[^\\001-\\004\\t\\n\\r ][^\\001-\\004\\n]*[^\\001-\\004\\t\\n\\r ]|[^\\001-\\004\\t\\n\\r ]/ })({ } | { /schedule/ = /daily|weekly|monthly|yearly/ } | { /rotate/ = /[+-]?[0-9]+/ } | { /create/ } | { /nocreate/ } | { /su/ } | { /include/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /missingok/ = /(no)?missingok/ } | { /compress/ = /(no)?compress/ } | { /delaycompress/ = /(no)?delaycompress/ } | { /ifempty/ = /(not)?ifempty/ } | { /sharedscripts/ = /(no)?sharedscripts/ } | { /size/ = /[+-]?[0-9]+[GMk]?/ } | { /tabooext/ = /((\\\\+))?/ } | { /olddir/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /noolddir/ } | { /mail/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /mailfirst/ } | { /maillast/ } | { /nomail/ } | { /errors/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /extension/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /dateext/ = /(no)?dateext/ } | { /compresscmd/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /uncompresscmd/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /compressext/ = /[^\\001-\\004\\t\\n #,={}]+/ } | { /compressoptions/ } | { /copy/ = /(no)?copy/ } | { /copytruncate/ = /(no)?copytruncate/ } | { /maxage/ = /[+-]?[0-9]+/ } | { /minsize/ = /[+-]?[0-9]+[GMk]?/ } | { /shred/ = /(no)?shred/ } | { /shredcycles/ = /[+-]?[0-9]+/ } | { /start/ = /[+-]?[0-9]+/ } | { /(pre|post)rotate|(first|last)action/ = /((((([\\t ][\\t ]*e|e)ndscript[\\t ][\\t ]*[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscript[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscrip([^\\001-\\004\\nt][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscri([^\\001-\\004\\np][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscr([^\\001-\\004\\ni][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndsc([^\\001-\\004\\nr][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nds([^\\001-\\004\\nc][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nd([^\\001-\\004\\ns][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)n([^\\001-\\004\\nd][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)([^\\001-\\004\\nn][^\\001-\\004\\n]*|)|[\\t ][\\t ]*([^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|)|[^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|)(\\n(([\\t ][\\t ]*e|e)ndscript[\\t ][\\t ]*[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscript[^\\001-\\004\\t\\n ][^\\001-\\004\\n]*|([\\t ][\\t ]*e|e)ndscrip([^\\001-\\004\\nt][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscri([^\\001-\\004\\np][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndscr([^\\001-\\004\\ni][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)ndsc([^\\001-\\004\\nr][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nds([^\\001-\\004\\nc][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)nd([^\\001-\\004\\ns][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)n([^\\001-\\004\\nd][^\\001-\\004\\n]*|)|([\\t ][\\t ]*e|e)([^\\001-\\004\\nn][^\\001-\\004\\n]*|)|[\\t ][\\t ]*([^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|)|[^\\001-\\004\\t\\n e][^\\001-\\004\\n]*|))*)?))?/ } | { /#comment/ = /[^\\001-\\004\\t\\n\\r ][^\\001-\\004\\n]*[^\\001-\\004\\t\\n\\r ]|[^\\001-\\004\\t\\n\\r ]/ })*)?\n  with tree\n    { \"file\" = \"/var/log/mail.info\" } { \"file\" = \"/var/log/mail.warn\" } { \"file\" = \"/var/log/mail.err\" } { \"file\" = \"/var/log/mail.log\" } { \"file\" = \"/var/log/daemon.log\" } { \"file\" = \"/var/log/kern.log\" } { \"file\" = \"/var/log/auth.log\" } { \"file\" = \"/var/log/user.log\" } { \"file\" = \"/var/log/lpr.log\" } { \"file\" = \"/var/log/cron.log\" } { \"file\" = \"/var/log/debug\" } { \"file\" = \"/var/log/messages\" } { \"rotate\" = \"4\" } { \"schedule\" = \"weekly\" } { \"missingok\" = \"missingok\" } { \"ifempty\" = \"notifempty\" } { \"compress\" = \"compress\" } { \"delaycompress\" = \"delaycompress\" } { \"sharedscripts\" = \"sharedscripts\" } { \"postrotate\" = \"\t\treload rsyslog >/dev/null 2>&1 || true\" } { \"file\" = \"/var/log/jlewis2.log\" }"

yum conf lens doesn't allow spaces around =

on centos the /etc/yum.repos.d/rpmforge.repo that comes with installing the rpmforge rpm has spaces on both sides of the equals sign in assignments like this:

[rpmforge]
name = RHEL $releasever - RPMforge.net - dag
baseurl = http://apt.sw.be/redhat/el6/en/$basearch/rpmforge

this fix allows augeas to work with the file: sed -i 's/ = /=/g' /etc/yum.repos.d/rpmforge.repo

Is it true that we could add a separator to lenses/yum.aug:10 such as let sep = IniFile.sep "=" "=" " = "
to handle this situation?

lens_ktype and lens_vtype are broken

lens_ktype and lens_vtype always returns /()/:

module Bar =

let t = [ key "a" ]
let _ = print_regexp(lens_ktype t)
let _ = print_endline ""

let u = [ label "a" . store "b" ]
let _ = print_regexp(lens_ktype u)
let _ = print_endline ""
 $ augparse bar.aug 
/()/
/()/

logrotate lens fails to parse when no-space between file and {

Hello,

We are using augeas-1.0.0-5.el6_5.1 on a RedHat 6.5 system. Our syslog-ng logrotate config file looks like:

/var/log/syslog /var/log/secure{
    compress
    sharedscripts
    postrotate
    /bin/kill -HUP `cat /var/run/syslog-ng.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

Augeas is not able to parse this file:

augtool> print //files/etc/logrotate.d/syslog-ng
/augeas/files/etc/logrotate.d/syslog-ng
/augeas/files/etc/logrotate.d/syslog-ng/path = "/files/etc/logrotate.d/syslog-ng"
/augeas/files/etc/logrotate.d/syslog-ng/mtime = "1399378192"
/augeas/files/etc/logrotate.d/syslog-ng/lens = "@Logrotate"
/augeas/files/etc/logrotate.d/syslog-ng/lens/info = "/usr/share/augeas/lenses/dist/logrotate.aug:117.13-.56:"
/augeas/files/etc/logrotate.d/syslog-ng/error = "parse_failed"
/augeas/files/etc/logrotate.d/syslog-ng/error/pos = "0"
/augeas/files/etc/logrotate.d/syslog-ng/error/line = "1"
/augeas/files/etc/logrotate.d/syslog-ng/error/char = "0"
/augeas/files/etc/logrotate.d/syslog-ng/error/lens = "/usr/share/augeas/lenses/dist/logrotate.aug:117.13-.56:"
/augeas/files/etc/logrotate.d/syslog-ng/error/message = "Iterated lens matched less than it should"

This issue seems to be caused by the lack of white-space between file list and "{". It would be nice if logrotate lens can handle this kind of use case.

Regards,
Xavier

ld.so.conf.d errors on a vanilla kernel-2.6.x.el6.x86_64.conf

i'm using augeas via puppet on a few different versions of RHEL (6.4 and 6.5 relevant here) and seeing errors out of the box:

Opening augeas with root /, lens path , flags 32
Augeas version 1.0.0 is installed
Loading failed for one or more files, output from /augeas//error:
/augeas/files/etc/ld.so.conf.d/kernel-2.6.32-431.el6.x86_64.conf/error = parse_failed
/augeas/files/etc/ld.so.conf.d/kernel-2.6.32-431.el6.x86_64.conf/error/pos = 307
/augeas/files/etc/ld.so.conf.d/kernel-2.6.32-431.el6.x86_64.conf/error/line = 6
/augeas/files/etc/ld.so.conf.d/kernel-2.6.32-431.el6.x86_64.conf/error/char = 0
/augeas/files/etc/ld.so.conf.d/kernel-2.6.32-431.el6.x86_64.conf/error/lens = /usr/share/augeas/lenses/dist/ldso.aug:31.10-.55:
/augeas/files/etc/ld.so.conf.d/ /augeas/files/etc/ld.so.conf.d/kernel-2.6.32-431.el6.x86_64.conf/error/message = Iterated lens matched less than it should

the contents of this file is the same on both my 6.4 and 6.5 hosts:

# This directive teaches ldconfig to search in nosegneg subdirectories
# and cache the DSOs there with extra bit 1 set in their hwcap match
# fields.  In Xen guest kernels, the vDSO tells the dynamic linker to
# search in nosegneg subdirectories and to match this extra hwcap bit
# in the ld.so.cache file.
hwcap 1 nosegneg

so it doesn't like the 'hwcap 1 nosegneg' specification - but according to some quick googling, that is a valid setting

Automounter lens does not handle hosts with dashes in them

Debug: Augeas[autofs::mount::update-direct-alexstore01_000](provider=augeas): /augeas/files/etc/auto.direct/error/message = Failed to match 
    ({ /host/ = /[^\001-\004\t\n #,:\\-]+/ }({ /host/ = /[^\001-\004\t\n #,:\\-]+/ })*)?{ /path/ = /[^\001-\004\t\n #+:-][^\001-\004\t\n #:]*/ }
  with tree
    { "host" = "alexstore01-000.example.com" } { "path" = "/exports/alexroots_default/alexdefaultstore1_000" }

Undefined refernce to YYID

Hi!
build augeas failed for me
Ubuntu 12.04 64bit, gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5), bison (GNU Bison) 3.0.2 from sources.
Error:

  CCLD   liblexer.la
  CCLD   libaugeas.la
  CC     augtool.o
  CCLD   augtool
./.libs/libaugeas.so: undefined reference to `YYID'
collect2: ld returned 1 exit status
make[3]: *** [augtool] Error 1
make[3]: Leaving directory `/tmp/augeas/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/tmp/augeas/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/tmp/augeas'
make: *** [all] Error 2

Ability to modify files under /proc

When saving files under the /proc directory, creating a temporary file (which is part of the save process) is not allowed by the operating system.

For reference, here's the error:
/augeas/files/proc/sys/net/ipv4/ip_forward/error = "mk_augtemp"
/augeas/files/proc/sys/net/ipv4/ip_forward/error/message = "No such file or directory"

mktemp could be a possible solution

Can not parse the configure files which are used to report a bug to bugzilla

Version-Release number of selected component (if applicable):
augeas-1.1.0-12.el7

How to reproduce

  1. Install the following packages:
    abrt-java-connector-1.0.6-6.el7
    libreport-anaconda-2.1.11-9.el7
    libreport-plugin-bugzilla-2.1.11-9.el7
  2. Run command: echo 'print /augeas//error'|augtool
    #echo 'print /augeas//error'|augtool
    /augeas/files/etc/libreport/plugins/bugzilla_format_java.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_format_java.conf/error/pos = "1388"
    /augeas/files/etc/libreport/plugins/bugzilla_format_java.conf/error/line = "39"
    /augeas/files/etc/libreport/plugins/bugzilla_format_java.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_format_java.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_format_java.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_java.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_java.conf/error/pos = "1388"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_java.conf/error/line = "39"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_java.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_java.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_java.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_format.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_format.conf/error/pos = "1498"
    /augeas/files/etc/libreport/plugins/bugzilla_format.conf/error/line = "41"
    /augeas/files/etc/libreport/plugins/bugzilla_format.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_format.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_format.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_format_kernel.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_format_kernel.conf/error/pos = "1388"
    /augeas/files/etc/libreport/plugins/bugzilla_format_kernel.conf/error/line = "39"
    /augeas/files/etc/libreport/plugins/bugzilla_format_kernel.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_format_kernel.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_format_kernel.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_format_libreport.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_format_libreport.conf/error/pos = "1388"
    /augeas/files/etc/libreport/plugins/bugzilla_format_libreport.conf/error/line = "39"
    /augeas/files/etc/libreport/plugins/bugzilla_format_libreport.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_format_libreport.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_format_libreport.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup.conf/error/pos = "1925"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup.conf/error/line = "50"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_format_anaconda.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_format_anaconda.conf/error/pos = "1498"
    /augeas/files/etc/libreport/plugins/bugzilla_format_anaconda.conf/error/line = "41"
    /augeas/files/etc/libreport/plugins/bugzilla_format_anaconda.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_format_anaconda.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_format_anaconda.conf/error/message = "Iterated lens matched less than it should"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf/error = "parse_failed"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf/error/pos = "1925"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf/error/line = "50"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf/error/char = "0"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf/error/lens = "/usr/share/augeas/lenses/libreport.aug:20.14-.43:"
    /augeas/files/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf/error/message = "Iterated lens matched less than it should"

Actual results:
Parse failed

Expected results:
No errors like: /augeas/files/etc/libreport/plugins/bugzilla*

Additional info:
Augeas can not parse the following files:
/etc/libreport/plugins/bugzilla_format_java.conf
/etc/libreport/plugins/bugzilla_formatdup_java.conf
/etc/libreport/plugins/bugzilla_format.conf
/etc/libreport/plugins/bugzilla_format_kernel.conf
/etc/libreport/plugins/bugzilla_format_libreport.conf
/etc/libreport/plugins/bugzilla_formatdup.conf
/etc/libreport/plugins/bugzilla_format_anaconda.conf
/etc/libreport/plugins/bugzilla_formatdup_anaconda.conf

Error parsing iptables file

I am using augeas with puppet. If this should be moved to the puppet issues page please let me know.

Below is the debug log from puppet and the iptables configuration file it doesn't like. Please let me know if I can provide any additional information.

Debug: Augeas[network peerdns setup eth0](provider=augeas): Opening augeas with root /, lens path , flags 32
Debug: Augeas[network peerdns setup eth0](provider=augeas): Augeas version 1.0.0 is installed
Feb 17 23:14:42 base-image-v20140118 puppet-agent[30172]: (Augeas[network peerdns setup eth0](provider=augeas)) Loading failed for one or more files, see debug for /augeas//error output
Warning: Augeas[network peerdns setup eth0](provider=augeas): Loading failed for one or more files, see debug for /augeas//error output
Debug: Augeas[network peerdns setup eth0](provider=augeas): /augeas/files/etc/sysconfig/iptables.save/error = parse_failed
Debug: Augeas[network peerdns setup eth0](provider=augeas): /augeas/files/etc/sysconfig/iptables.save/error/pos = 64
Debug: Augeas[network peerdns setup eth0](provider=augeas): /augeas/files/etc/sysconfig/iptables.save/error/line = 2
Debug: Augeas[network peerdns setup eth0](provider=augeas): /augeas/files/etc/sysconfig/iptables.save/error/char = 0
Debug: Augeas[network peerdns setup eth0](provider=augeas): /augeas/files/etc/sysconfig/iptables.save/error/lens = /usr/share/augeas/lenses/dist/shellvars.aug:163.12-.99:
Debug: Augeas[network peerdns setup eth0](provider=augeas): /augeas/files/etc/sysconfig/iptables.save/error/message = Syntax error
Debug: Augeas[network peerdns setup eth0](provider=augeas): Will attempt to save and only run if files changed
Debug: Augeas[network peerdns setup eth0](provider=augeas): sending command 'set' with params ["/files/etc/sysconfig/network-scripts/ifcfg-eth0/PEERDNS", "no"]
Debug: Augeas[network peerdns setup eth0](provider=augeas): Skipping because no files were changed
Debug: Augeas[network peerdns setup eth0](provider=augeas): Closed the augeas connection
# Generated by iptables-save v1.4.7 on Mon Feb 17 22:15:20 2014
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1:260]
-A INPUT -p icmp -m comment --comment "000 accept all icmp" -j ACCEPT
-A INPUT -i lo -m comment --comment "001 accept all to lo interface" -j ACCEPT
-A INPUT -m comment --comment "002 accept related and established" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m multiport --ports 22 -m comment --comment "003 accept ssh from everywhere" -m state --state NEW -j ACCEPT
COMMIT
# Completed on Mon Feb 17 22:15:20 2014

add support for "verbose" directive to grub lens

Statements like

verbose = 0

in grub.conf cause augeas to fail parsing. Suggested patch:

--- grub.aug.org 2014-01-14 14:51:15.609272570 +0000
+++ grub.aug 2014-01-14 15:14:00.088250268 +0000
@@ -78,6 +78,7 @@
| kw_menu_arg "splashimage"
| kw_menu_arg "gfxmenu"
| kw_menu_arg "background"

  •                 | kw_menu_arg "verbose"
                  | serial
                  | terminal
                  | password_arg
    

Properties lens does not work with multiline properties

The lens doesn't work anymore as soon as there is a multiline property - as in a line ends with '' and gets continued in the next line.

An example would be:

tomcat.util.scan.DefaultJarScanner.jarsToSkip=
bootstrap.jar,commons-daemon.jar,tomcat-juli.jar

which is perfectly valid, as in is the same as

tomcat.util.scan.DefaultJarScanner.jarsToSkip=bootstrap.jar,commons-daemon.jar,tomcat-juli.jar

which works as expected.

The used Augeas version is 1.0 on CentOS 6.4.

nrpe lens does not allow forward slash in command name

My nrpe.cfg has some entries like

command[check_/]=/usr/local/nagios/libexec/check_disk -w 20% -c 10% -p /

This kills augeas with a parse_error:

/augeas/files/usr/local/nagios/etc/nrpe.cfg/error/message = "Iterated lens matched less than it should"

I tracked the problem down to the definition of a command in the lens

let command =
  let obrkt = del /\[/ "[" in
  let cbrkt = del /\]/ "]" in
    [ key "command" .
    [ obrkt . key /[^]\/\n]+/ . cbrkt . eq
            . store /[^\n]+/ . del /\n/ "\n" ]
    ]

The key line excludes slashes, so I tried making a custom lens and changing the line so slashes were valid (by removing the / from the regex)

   [ obrkt . key /[^]\n]+/ . cbrkt . eq

But now augtool dies with an even worse error than a parse_error!

/usr/share/augeas/lenses/localnrpe.aug:28.0-34.5:Failed to compile command
/usr/share/augeas/lenses/localnrpe.aug:32.14-.27:exception: The key regexp /[^]
]+/ matches a '/'

It looks like I'm not allowed to have a slash inside the key? I'm guessing that's because augeas uses slash as a separator. But what about cases where I want to use as slash as part of my string? It would be nice if I had the option of escaping the forwardslash but from my testing that doesn't work.

Httpd lens chokes on a regex

Parsing an Apache config, I get:

pos = 720
line = 22
char = 21
lens = /usr/share/augeas/lenses/dist/httpd.aug:88.10-.44:
message = Syntax error

Which lines up with the a tilde used for a regex in a directive.

<Directory ~ "/.svn >

Is the line where char = 21 is ~.

This is valid according to http://httpd.apache.org/docs/2.4/mod/core.html#directory

Using augtool installed via yum on Red Hat Enterprise Linux Server release 5.6. augtool version 1.0.0.

Please let me know if I can provide any other information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.