0

部署到 Elasticbeanstalk 时,我的部署失败并出现由 .ebextension 文件夹中的 .config 文件引起的解析错误,但对我来说似乎没问题。任何人都可以告诉我如何解决它?.config 文件如下所示:

files:
   "/opt/elasticbeanstalk/hooks/appdeploy/post/01_copy_htaccess_after_deployment.sh":
     mode: "000755",
     owner: root,
     group: root,
     content: |
       yes | /bin/cp /var/app/current/.htaccess.new /var/app/current/.htaccess

和错误:

应用程序版本 git-bce52a5381c7ac6735249419c48b1fe116168610-1494415808045 中的配置文件 .ebextensions/08_htaccess_create_script_post_deploy.config 包含无效的 YAML 或 JSON。YAML 异常:无效的 Yaml:在解析“”第 3 行第 10 列中的块映射时:模式:“000755”,^ 预期,但在“”第 3 行第 24 列中找到 FlowEntry:模式:“000755”,^ , JSON 异常:无效的 JSON:位置 0 的意外字符 (f).. 更新配置文件。

4

1 回答 1

1

根据aws dcumentation,您不需要在模式所有者和组后面使用逗号。所以你的 yml 配置文件应该是这样的:

files:
   "/opt/elasticbeanstalk/hooks/appdeploy/post/01_copy_htaccess_after_deployment.sh":
     mode: "000755"
     owner: root
     group: root
     content: |
       yes | /bin/cp /var/app/current/.htaccess.new /var/app/current/.htaccess

这是语法的一个例子

files:  
  "target file location on disk": 
     mode: "six-digit octal value"
     owner: name of owning user for file
     group: name of owning group for file
     source: URL
     authentication: authentication name:

  "target file location on disk": 
     mode: "six-digit octal value"
     owner: name of owning user for file
     group: name of owning group for file
     content: |
    this is my content
     encoding: encoding format
     authentication: authentication name:
于 2017-05-10T12:02:36.807 回答