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
已提問 3 年前檢視次數 452 次
1 個回答
0
已接受的答案

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
已回答 3 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南