Sample file for augeas

485 views Asked by At

I am searching for example of file which could be passed to the augeas:

augeas --f example/file

So far my file looks like this:

 set /files/etc/hosts/01/ipaddr 127.0.2.1
 set /files/etc/hosts/01/alias[1] testy
 set /files/etc/hosts/01/alias[2] test
 save

And if I pass the file to the augeas it tells me this:

 error: Failed to execute command
 saving failed (run 'print /augeas//error' for details)

Obviously, I did what the command line told me:

 janipav@janipav:~$ print /augeas//error
 Warning: unknown mime-type for "/augeas//error" -- using "application/octet-stream"
 Error: no such file "/augeas//error"

So, I am pretty much stuck here. Googling did not provide me anything, so I hope to find answer here. Thanks

1

There are 1 answers

0
raphink On BEST ANSWER

The canonical node is mandatory for hosts entries with the Hosts.lns lens, so you need:

set /files/etc/hosts/01/ipaddr 127.0.2.1
set /files/etc/hosts/01/canonical localhost2
set /files/etc/hosts/01/alias[1] testy
set /files/etc/hosts/01/alias[2] test
save

Note that this change is not idempotent, it will create a new entry at every run.