Unzip Component Not Working

0

Recipe
{
"RecipeFormatVersion": "2020-01-25",
"ComponentName": "com.example.HelloWorld",
"ComponentVersion": "5.0.15",
"ComponentType": "aws.greengrass.generic",
"ComponentDescription": "My first AWS IoT Greengrass component.",
"ComponentPublisher": "WaterExpert",
"ComponentConfiguration": {
"DefaultConfiguration": {
"accessControl": {
"aws.greengrass.ipc.mqttproxy": {
"com.example.HelloWorld:pubsub:1": {
"policyDescription": "Allows access to publish to my/topic.",
"operations": [
"aws.greengrass#PublishToTopic",
"aws.greengrass#PublishToIoTCore",
"aws.greengrass#GreengrassCoreIPC"
],
"resources": [
"my/topic"
]
}
}
}
}
},
"Manifests": [
{
"Platform": {
"os": "linux"
},
"Name": "Linux",
"Lifecycle": {
"Run": "python3 {artifacts:path}/main.py"
},
"Artifacts": [
{
"Uri": "s3://braydenggctest/main2.zip",
"Digest": "re9Y7xzQgB8jbZtE0Y3Xg2sd0dZGl3Ydb048fPhDvH0=",
"Algorithm": "SHA-256",
"Unarchive": "ZIP",
"Permission": {
"Read": "OWNER",
"Execute": "NONE"
}
}
]
}
],
"Lifecycle": {}
}

I can manually unzip the file after deployment but the deployment fails to unzip it (trys to run main.py but file doesn't exist. I can manually unzip and then restart ggc and it'll read it)

brayden
asked 3 years ago441 views
1 Answer
0
Accepted Answer

Hi,
In order to use archived artifacts in the lifecycle of a component within the recipe, you have to specify the unarchived path of the artifacts which is {artifacts:decompressedPath}. In your case, this will be as shown below where main2 is the name of the zip file and main.py is file inside it.

"Lifecycle": {
"Run": "python3 {artifacts:decompressedPath}/main2/main.py"
},

Thanks,
Saranya

AWS
Saranya
answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions