zoukankan      html  css  js  c++  java
  • Puppet学习:Augeas的怪问题

    今天测试部署Zabbix,本来以前是正常的,今天莫名其妙报错。测试后发现是Augeas出现问题,无论如何都不执行。于是采用调试模式:

    puppet agent --test --verbose --debug

    然后捕捉到了下面的信息:

    Debug: Augeas[update-php-parma](provider=augeas): Opening augeas with root /, lens path , flags 32
    Debug: Augeas[update-php-parma](provider=augeas): Augeas version 0.9.0 is installed
    Debug: Augeas[update-php-parma](provider=augeas): Loading failed for one or more files, output from /augeas//error:
    Debug: Augeas[update-php-parma](provider=augeas): /augeas/files/etc/ntp.conf/error/pos = 822
    Debug: Augeas[update-php-parma](provider=augeas): /augeas/files/etc/ntp.conf/error/line = 22
    Debug: Augeas[update-php-parma](provider=augeas): /augeas/files/etc/ntp.conf/error/char = 0
    Debug: Augeas[update-php-parma](provider=augeas): /augeas/files/etc/ntp.conf/error/lens = /usr/share/augeas/lenses/dist/ntp.aug:115.14-118.40:
    Debug: Augeas[update-php-parma](provider=augeas): /augeas/files/etc/ntp.conf/error/message = Iterated lens matched less than it should
    Debug: Augeas[update-php-parma](provider=augeas): Will attempt to save and only run if files changed
    Debug: Augeas[update-php-parma](provider=augeas): sending command 'set' with params ["/etc/php.ini/PHP/date.timezone", "Asia/Shanghai"]
    Debug: Augeas[update-php-parma](provider=augeas): sending command 'set' with params ["/etc/php.ini/PHP/post_max_size", "16M"]
    Debug: Augeas[update-php-parma](provider=augeas): sending command 'set' with params ["/etc/php.ini/PHP/max_execution_time", "300"]
    Debug: Augeas[update-php-parma](provider=augeas): sending command 'set' with params ["/etc/php.ini/PHP/max_input_time", "300"]
    Debug: Augeas[update-php-parma](provider=augeas): sending command 'set' with params ["/etc/php.ini/MySQL/mysql.default_socket", "/mysql/var/mysql.sock"]
    Debug: Augeas[update-php-parma](provider=augeas): Skipping because no files were changed
    Debug: Augeas[update-php-parma](provider=augeas): Closed the augeas connection

    首先,没有修改过ntp.conf文件,所以很纳闷啊~(呵呵,刚想起来,ntp.conf中的server写成service,所以才会报错,一个小坑……)

    在app_zabbix::conf中的配置节是这么写的

    augeas {"update-php-parma" :
        context     =>  "/etc/php.ini",
        changes     =>  [
            "set PHP/date.timezone Asia/Shanghai",
            "set PHP/post_max_size 16M",
            "set PHP/max_execution_time 300",
            "set PHP/max_input_time 300",
            "set MySQL/mysql.default_socket /mysql/var/mysql.sock",
            ],
        notify      =>  Service["httpd"],
    }

    后来在测试机上测试了下,需要安装augeas:

    augtool> set "/etc/php.ini/PHP/date.timezone" "Asia/Shanghai"
    augtool> save
    augtool> get "/etc/php.ini/PHP/date.timezone"
    /etc/php.ini/PHP/date.timezone = Asia/Shanghai

    直接在命令行中执行就失败(话说我写日志的时候就OK了,之前怎么弄都无法写入)。

    呃……解决办法是,所有的context都必须是/files下的,如

    augeas {"update-php-parma" :
        context     =>  "/files/etc/php.ini",
        changes     =>  [
            "set PHP/date.timezone Asia/Shanghai",
            "set PHP/post_max_size 16M",
            "set PHP/max_execution_time 300",
            "set PHP/max_input_time 300",
            "set MySQL/mysql.default_socket /mysql/var/mysql.sock",
            ],
        notify      =>  Service["httpd"],
    }

    我去撞墙了……之前写成file当然没用了,后来又去掉了,这就是不认真看官方文档的下场……

  • 相关阅读:
    更改sql server数据库所有者的对象
    对C#委托及事件委托的理解
    印度人是怎样开发软件的?
    SQL常用函数
    Ajax学习1
    Ajax学习2
    什么是ORM?
    jQuery 移动网页到制定的位置
    Juery 控件的取值赋值
    js禁用滚动条
  • 原文地址:https://www.cnblogs.com/rexkang/p/puppet-study-augeas-problem.html
Copyright © 2011-2022 走看看