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
gefragt vor 3 Jahren452 Aufrufe
1 Antwort
0
Akzeptierte Antwort

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
beantwortet vor 3 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen