问题
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