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

--add-function causes NullPointerException #156

Closed QuinnCiccoretti closed 5 years ago

QuinnCiccoretti commented 5 years ago

According to the command line docs, I set up a group with the python hello world:

./ggp.sh -g test-group -a X86_64 -d deployments/python-hello-world.conf --script

And a second group with the python http function:

./ggp.sh -g test-group2 -a X86_64 -d deployments/http-python.conf --script

I then attempted to add the python http function to the first group:

./ggp.sh -g test-group --update-group --add-function test-group2-HTTPPython --function-alias UNIQUEALIAS

(UNIQUEALIAS is not a placeholder, it's literally what I used, which was unique for my function)

This operation succesfully pulls the most recent docker image and then generates the following error.

[ERROR] AwsGreengrassProvisioner: null
java.lang.NullPointerException
    at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicGreengrassHelper.getDefaultIsolationMode(BasicGreengrassHelper.java:985)
    at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicGroupUpdateHelper.addFunction(BasicGroupUpdateHelper.java:252)
    at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicGroupUpdateHelper.execute(BasicGroupUpdateHelper.java:82)
    at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicGroupUpdateHelper.execute(BasicGroupUpdateHelper.java:19)
    at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.Operation.executeOrDisplayHelp(Operation.java:33)
    at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.Operation.lambda$execute$1(Operation.java:21)
    at io.vavr.control.Try.onSuccess(Try.java:712)
    at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.Operation.execute(Operation.java:21)
    at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$null$2(AwsGreengrassProvisioner.java:86)
    at java.util.Optional.map(Optional.java:215)
    at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$run$da6d192b$1(AwsGreengrassProvisioner.java:86)
    at io.vavr.control.Try.of(Try.java:75)
    at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.run(AwsGreengrassProvisioner.java:81)
    at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.runProvisioner(AwsGreengrassProvisioner.java:59)
    at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$main$249538b4$1(AwsGreengrassProvisioner.java:31)
    at io.vavr.control.Try.of(Try.java:75)
    at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.main(AwsGreengrassProvisioner.java:31)
[ERROR] AwsGreengrassProvisioner: null

In the Lambda console, the test-group2-HTTPPython function does have the UNIQUEALIAS listed under qualifiers. However, the lambda has not been added to test-group. I am using the docker version of the provisioner on Ubuntu 18.04 and a freshly cloned version of the aws-greengrass-lambda repository.

timmattison commented 5 years ago

Looking into it now.

timmattison commented 5 years ago

I see what's going on here now. Think I need to find a better way to obtain the correct isolation mode.

timmattison commented 5 years ago

This an issue in both the deployment code and the update code.

In deployments, the default isolation mode is set to no container when it makes sense. But it is left NULL if the default is the Greengrass container.

In updates, the default value is assumed to be present.

Proposed fixes:

timmattison commented 5 years ago

This works for me now but please re-open this if you run into any trouble. Thanks for reporting it!