akamai / cli-cloudlets

Akamai CLI for Cloudlets allows you to work with cloudlets from the Command Line
Apache License 2.0
3 stars 9 forks source link

0 exit code for cases of failed activation #1

Closed partamonov closed 2 years ago

partamonov commented 3 years ago

If there is a pending activation cloudlets CLI is returning 0 instead of 1.

I do think that problem is in missing exit(-1) after https://github.com/akamai/cli-cloudlets/blob/aafb134754fee56e955a87720e56f7947d69d6ab/bin/akamai-cloudlets.py#L641

Example issue output

[Container] 2021/06/23 11:18:33 Running command akamai cloudlets  activate --policy ${NAME} --network 
 $AKAMAI_NETWORK --version $ENV_VERSION
...searching for cloudlet policy NAME
...found policy-id 123456
Activating NAME v1 to STAGING
ERROR: Unable to activate policy
{
    "errorCode": -1,
    "detail": "Unable to activate policy \"NAME\", version=1.\n\n Details: Unable to activate because a previous activation for this policy is pending.",
    "instance": "xxx",
    "status": 400,
    "title": "Bad Argument or Value",
    "type": "/cloudlets/error-types/illegal-argument",
    "errorMessage": "Unable to activate policy \"NAME\", version=1.\n\n Details: Unable to activate because a previous activation for this policy is pending."
}

[Container] 2021/06/23 11:18:35 Running command echo $?
0

I would expect to have 1 exit code

aetsai commented 2 years ago

should be fixed now with v1.0.1