首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >空白的augeas设置值失败

空白的augeas设置值失败
EN

Stack Overflow用户
提问于 2013-08-25 12:22:50
回答 2查看 1.6K关注 0票数 0

当我设置值(augeas-0.10.0与pupy-2.7.11一起使用)时,我遇到了与空格,ex有关的问题。

代码语言:javascript
复制
...

changes => "set *[self::directive='FastCgiExternalServer']/arg '/usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization'",
...

保存完之后,我得到了这个错误消息:

代码语言:javascript
复制
/augeas/files/etc/apache2/mods-available/fastcgi.conf/error = "put_failed"
/augeas/files/etc/apache2/mods-available/fastcgi.conf/error/path = "/files/etc/apache2/mods-available/fastcgi.conf/IfModule/directive"
/augeas/files/etc/apache2/mods-available/fastcgi.conf/error/lens = "/usr/share/augeas/lenses/dist/httpd.aug:76.18-77.49:"
/augeas/files/etc/apache2/mods-available/fastcgi.conf/error/message = "Failed to match \n    ({ /arg/ = /([^\001-\004\t\n \"']|\\\\\"|\\\\')+|\"([^\001-\004\n\"\\]|\\\\[^\001-\004\n])\"|'([^\001-\004\n'\\]|\\\\[^\001-\004\n])'/ }({ /arg/ = /([^\001-\004\t\n \"']|\\\\\"|\\\\')+|\"([^\001-\004\n\"\\]|\\\\[^\001-\004\n])\"|'([^\001-\004\n'\\]|\\\\[^\001-\004\n])'/ })*)?\n  with tree\n    { \"arg\" = \"/usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization\" }"

我尝试过不同的方法来逃避这个值,但是每次尝试都以同样的错误失败了。我做错什么了?感谢任何有帮助的答案!

EN

回答 2

Stack Overflow用户

发布于 2013-08-25 14:47:44

你有两个问题:

  • 您的更改可能会创建一个没有父arg节点的directive节点,这在Httpd.lns镜头中是无效的;
  • 您需要在值周围强制引号,因为它包含空格。

所以(使用augtool):

代码语言:javascript
复制
# Make sure the directive exists
set directive[. = 'FastCgiExternalServer'] FastCgiExternalServer
# Set the argument
set directive[. = 'FastCgiExternalServer']/arg '"/usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization"'

应该工作得更好。

票数 1
EN

Stack Overflow用户

发布于 2014-10-29 15:10:40

"arg“实际上是一张清单。每一个论点都应列举如下:

代码语言:javascript
复制
defvar conf /files/etc/apache2/sites-available/foo
clear $conf/VirtualHost
set $conf/VirtualHost/arg "172.16.0.1:80"
set $conf/VirtualHost/directive "FastCgiExternalServer"
set $conf/VirtualHost/*[self::directive='FastCgiExternalServer']/arg[0] "/usr/lib/cgi-bin/php5-fcgi"
set $conf/VirtualHost/*[self::directive='FastCgiExternalServer']/arg[1] "-socket"
set $conf/VirtualHost/*[self::directive='FastCgiExternalServer']/arg[2] "/var/run/php5-fpm.sock"
set $conf/VirtualHost/*[self::directive='FastCgiExternalServer']/arg[3] "-pass-header"
set $conf/VirtualHost/*[self::directive='FastCgiExternalServer']/arg[4] "Authorization"

它生成以下文件:

代码语言:javascript
复制
<VirtualHost 172.16.0.1:80>
FastCgiExternalServer -socket /var/run/php5-fpm.sock -pass-header Authorization
</VirtualHost>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18428930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档