1

I created an auto-scaling in the Bluemix UI saved it and then retrieved the policy using cf env. The policy was:

{
    "policyState": "ENABLED",
    "policyId": "",
    "instanceMinCount": 2,
    "instanceMaxCount": 5,
    "policyTriggers": [
        {
            "metricType": "Memory",
            "statWindow": 300,
            "breachDuration": 600,
            "lowerThreshold": 30,
            "upperThreshold": 80,
            "instanceStepCountDown": 1,
            "instanceStepCountUp": 1,
            "stepDownCoolDownSecs": 600,
            "stepUpCoolDownSecs": 600
        }
    ],
    "schedules": {
        "timezone": "(GMT +01:00) Africa/Algiers",
        "recurringSchedule": null,
        "specificDate": null
    }
}

I'm then trying to apply the policy from an IBM devops deploy stage:

curl https://ScalingAPI.ng.bluemix.net/v1/autoscaler/apps/xxxx/policy -X 'PUT' \
    -H 'Content-Type:application/json' \
    -H 'Accept:application/json' \
    -H 'Authorization:Bearer *****' \
    --data-binary @./autoscaling_policy.json \
    -s -o response.txt -w '%{http_code}\n'

The response:

{"error" : "CWSCV6003E: Input JSON strings format error: At least one schedule rule should be specified in schedules in the input JSON for API: Create/Update Policy for App xxxxx."}

The workaround was to remove the schedules element:

{
    "policyState": "ENABLED",
    "policyId": "",
    "instanceMinCount": 2,
    "instanceMaxCount": 5,
    "policyTriggers": [
        {
            "metricType": "Memory",
            "statWindow": 300,
            "breachDuration": 600,
            "lowerThreshold": 30,
            "upperThreshold": 80,
            "instanceStepCountDown": 1,
            "instanceStepCountUp": 1,
            "stepDownCoolDownSecs": 600,
            "stepUpCoolDownSecs": 600
        }
    ]
}

Question: Why did the UI not complaining about the schedule and allow me to export an invalid schedule that the API call did not like?

Chris Snow
  • 23,813
  • 35
  • 144
  • 309

0 Answers0