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

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

Provisioner crashes using --ec2-launch #55

Closed typemismatch closed 5 years ago

typemismatch commented 5 years ago

The provisioner creates the group and installation package, fails to obtain SSH keys to setup the ec2 instance.

[INFO] BasicDeploymentHelper: Deployment successful [ERROR] AwsGreengrassProvisioner: Is a directory Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Is a directory at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.handleProvisionerFailure(AwsGreengrassProvisioner.java:45) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$main$0(AwsGreengrassProvisioner.java:31) at io.vavr.control.Try.onFailure(Try.java:633) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.main(AwsGreengrassProvisioner.java:31) Caused by: java.io.IOException: Is a directory at sun.nio.ch.FileDispatcherImpl.read0(Native Method) at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:46) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) at sun.nio.ch.IOUtil.read(IOUtil.java:197) at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:159) at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65) at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109) at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103) at java.nio.file.Files.read(Files.java:3105) at java.nio.file.Files.readAllBytes(Files.java:3158) at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.IoHelper.lambda$readFile$c72e3cae$1(IoHelper.java:64) at io.vavr.control.Try.of(Try.java:75) at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.IoHelper.readFile(IoHelper.java:64) at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.IoHelper.readFileAsString(IoHelper.java:58) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicIoHelper.lambda$getPrivateKeyFilesForSsh$0(BasicIoHelper.java:45) at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicIoHelper.getPrivateKeyFilesForSsh(BasicIoHelper.java:47) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicIoHelper.lambda$getJschWithPrivateKeysLoaded$8d6a4564$1(BasicIoHelper.java:113) at io.vavr.control.Try.of(Try.java:75) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicIoHelper.getJschWithPrivateKeysLoaded(BasicIoHelper.java:113) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicIoHelper.getSshSessionTask(BasicIoHelper.java:143) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicDeploymentHelper.execute(BasicDeploymentHelper.java:742) at com.awslabs.aws.greengrass.provisioner.implementations.helpers.BasicDeploymentHelper.execute(BasicDeploymentHelper.java:55) at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.Operation.executeOrDisplayHelp(Operation.java:34) at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.Operation.lambda$execute$1(Operation.java:22) at io.vavr.control.Try.onSuccess(Try.java:648) at com.awslabs.aws.greengrass.provisioner.interfaces.helpers.Operation.execute(Operation.java:22) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$null$2(AwsGreengrassProvisioner.java:80) at java.util.Optional.map(Optional.java:215) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$run$da6d192b$1(AwsGreengrassProvisioner.java:80) at io.vavr.control.Try.of(Try.java:75) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.run(AwsGreengrassProvisioner.java:75) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.runProvisioner(AwsGreengrassProvisioner.java:53) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.lambda$main$249538b4$1(AwsGreengrassProvisioner.java:30) at io.vavr.control.Try.of(Try.java:75) at com.awslabs.aws.greengrass.provisioner.AwsGreengrassProvisioner.main(AwsGreengrassProvisioner.java:30)

timmattison commented 5 years ago

Looks like what is happening here is you have a subdirectory in your .ssh directory. The original code treated every entry in that directory as a file. It has been updated now to recursively look for keys to fix this.