AWS CodeDeploy Duplicate permission

北战南征 提交于 2019-12-11 04:04:13

问题


I'm trying to set permissions in my appspec.yml file, but I keep getting an error about duplicate permission settings when I run a deployment

Duplicate permission setting instructions for /data/html/httpdocs/artisan

This is currently (with except in list format) how the permission object is configured in my appspec.yml, per this threads recommendation . I actually have multiple files I want different permissions on, but I can't seem to get it to work w/ just one file? what is the correct way?

permissions:
  - object: /data/html/httpdocs/ 
    pattern: "**"
    except: [/data/html/httpdocs/artisan]
    owner: ubuntu
    group: www-data
    mode: 644
    type:
      - file
  - object: /data/html/httpdocs/artisan
    owner: ubuntu
    group: www-data
    mode: 755
    type:
      - file

回答1:


I just ran in to a similar issue and I ended up having to dig in to the codedeploy-agent source code.

The (poorly documented) except option for the CodeDeploy permissions currently accepts an array of relative filenames. You should be able to match your artisan file like this:

  permissions:
  - object: /data/html/httpdocs/ 
    pattern: "**"
    except: [artisan]
    owner: ubuntu
    group: www-data
    mode: 644
    type:
      - file
  - object: /data/html/httpdocs/artisan
    owner: ubuntu
    group: www-data
    mode: 755
    type:
      - file

Note that this will not work for folders or files nested within folders. You can use wildcards, but they will only match exceptions for the root directory of that object.

I had to move some of my scripts from a subfolder to the root because of this.

Here's a link to the relevent codedeploy-agent code.



来源:https://stackoverflow.com/questions/28413067/aws-codedeploy-duplicate-permission

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!