【问题标题】:Sample file for augeasaugeas 的示例文件
【发布时间】:2013-12-11 11:32:38
【问题描述】:

我正在搜索可以传递给 augeas 的文件示例:

augeas --f example/file

到目前为止,我的文件如下所示:

 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

如果我将文件传递给 augeas,它会告诉我:

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

显然,我按照命令行告诉我的做了:

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

所以,我几乎被困在这里。谷歌搜索没有为我提供任何东西,所以我希望在这里找到答案。谢谢

【问题讨论】:

  • 请注意,print /augeas//error 命令应该在 augeas 内部完成,而不是在 shell 中完成。如果您已经这样做了,而不是您的 save 命令,或者就在 save 命令之前,那么 augeas 会告诉您错误消息是什么。

标签: file ubuntu command-line sample augeas


【解决方案1】:

canonical 节点对于带有 Hosts.lns 镜头的 hosts 条目是必需的,因此您需要:

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

请注意,此更改不是幂等的,它会在每次运行时创建一个新条目。

【讨论】:

    猜你喜欢
    • 2016-04-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多