【问题标题】:unable to print augeas for own configuration无法为自己的配置打印 augeas
【发布时间】:2015-10-16 10:19:03
【问题描述】:

我有下面的 dtp.conf 文件用于内部需求。

/opt/dtp/etc/dtp.conf

export CHO='NON-PROD'

但是当我通过augtool打印配置文件时无法打印值

/opt/pupet/bin/augtool
augtool> print /files/opt/dtp/etc/dtp_config
augtool>

【问题讨论】:

    标签: puppet augeas


    【解决方案1】:

    我不记得 Augeas 对此文件有特定的镜头。 Augeas 无法猜测要使用哪个镜头(解析器),它需要知道哪个镜头与哪个文件相关联。

    在这种情况下,这看起来像 Shellvar 类型的文件,因此您可以使用例如:

    augtool -At "Shellvars.lns incl /opt/dtp/etc/dtp.conf"
    

    编辑它。

    在 Puppet 中,使用来自 augeasproviders_shellvar Puppet 模块的 shellvar 类型:

    shellvar { 'CHO':
      ensure => exported,
      target => '/opt/dtp/etc/dtp_config',
      value  => 'NON-PROD',
    }
    

    【讨论】:

    • 我在下面写了 manifests shellvar { "export CHO": ensure => present, target => "/opt/dtp/etc/dtp_config", value => "Non - prod" but getting error "服务器上的错误 400:Puppet::Parser::AST::Resource 失败并出现错误 ArgumentError: Invalid resource type shellvar at /etc/puppetlabs/puppet/modules/example/manifests/dtp.pp:14 on node”augtool 版本为 1.3 .0
    • 是的,我试过你“shellvars”sn-p,但得到“服务器上的错误 400:Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type shellvar at /etc/ puppetlabs/puppet/modules/example/manifests/dtp.pp:14 on node。我的puppet版本有问题吗。我使用的是puppet version3.8
    • 您是否安装了 augeasproviders_shellvar 和依赖项 (augeasproviders_core)?
    • 是的。我安装了 aueasproviders_shellvar 和 augeasproviders_core。但现在我收到“错误:/Stage[main]/Example::Cho/Shellvar[CHO]:无法评估:Augeas 没有使用 Shellvars.lns 加载 /opt/dtp/etc/dtp_config:语法错误”
    • 当你在调试模式下启动 puppet 时,它会告诉你哪一行解析失败。你能粘贴那行吗?另外,您使用的是哪个版本的 augeas?
    猜你喜欢
    • 1970-01-01
    • 2018-09-17
    • 2014-05-07
    • 2012-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-10-15
    相关资源
    最近更新 更多