aws-iot-builder-tools / aws-greengrass-provisioner

Simplifies provisioning Greengrass Cores and building Greengrass Lambda functions
Apache License 2.0
54 stars 15 forks source link

Error handling for invalid local resource configuration #160

Closed timmattison closed 5 years ago

timmattison commented 5 years ago

There are a few ways that local resources can cause the provisioner to fail:

An example of the error seen in case 2:

Greengrass service reported an error [Deployment 20152727-d68e-4384-a8f2-e704712f9b23 of type NewDeployment for group a7d23862-5e86-43c3-9347-cc11fe77edc1 failed error: Greengrass deployment error: unable to execute download step in deployment. error while processing: unable to load the group file downloaded: resource access policy is invalid, functionArn: arn:aws:lambda:us-east-1:zzz:function:fff-bbb:2, resource: /aaa/ddd/eee: user or group doesn't have permission on the file, userId: 109, userGroupId: [995 0], access: rw, filePath: /aaa/ddd/eee]

When case 2 occurs the provisioner goes into a loop disassociating and reassociating the role with the group because it is generically assumed to be an error related to the role not being available yet.

OscarVanL commented 5 years ago

I'm having this error, and it's caused by case 2. How exactly do I give the user running Greengrass permission to access this resource? I'm adding a Local volume resource, /home/pi/input, I've checked the "Automatically add OS group permissions of the Linux group that owns the resource." box and I've set read and write permissions, but when I press Deploy I get error:

Deployment ----------------- of type NewDeployment for group ------------- failed error: Greengrass deployment error: unable to execute download step in deployment. error while processing: unable to load the group file downloaded: resource access policy is invalid, functionArn: ----------, resource: /home/pi/input: user or group doesn't have permission on the file, userId: 111, userGroupId: [116 1000], access: rw, filePath: /home/pi/input

Here's the permissions on the folder:

pi@raspberrypi:~ $ ls -la input
total 8
drwxr-xr-x  2 pi pi 4096 Sep 16 14:13 .
drwxr-xr-x 13 pi pi 4096 Sep 16 14:13 ..
OscarVanL commented 5 years ago

Never mind, I fixed this with sudo chmod 0775 input, if anyone has the same issue :)