Skip to content

sandbox:update fails to ever set stop-schedule or start-schedule #577

@lawrencewalters

Description

@lawrencewalters

sfcc-ci Version

2.12.0

NodeJS Version

v10.24.1

sfcc-ci Path

/home/xxxxxxx/.nvm/versions/node/v10.24.1/bin/sfcc-ci

Host OS Details

Linux USHQL835 5.15.167.4-microsoft-standard-WSL2 #1 SMP Tue Nov 5 00:21:55 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Description

When making any request to sandbox:update with a stop-scheduler or start-scheduler request, the request always fails, and at the same time, sets auto-scheduled to false (see log output, where a --stop-scheduler request is made, and eventually the PATCH request is made, and the body simply has autoScheduled: false.

It turns out this an issue with parameter order in cli.js

        if (scheduleOk) {
            require('./lib/sandbox').cli.update(spec, ttl, autoScheduled, false, startScheduler, stopScheduler);
        }

But the function signature for update is:

   /**
     * Update a sandbox.
     *
     * @param {String} spec specification of the sandbox to update
     * @param {Number} ttl number of hours, the sandbox TTL will be prolonged
     * @param {Boolean} autoScheduled sets the sandbox as auto scheduled
     * @param {String} startScheduler start schedule for the sandbox
     * @param {String} stopScheduler stop schedule for the sandbox
     * @param {Boolean} asJson optional flag to force output in json, false by default
     */
    update : function(spec, ttl, autoScheduled, startScheduler, stopScheduler, asJson) {

so the hardcoded false parameter is throwing off the scheduler parameters, and thus a stopScheduler is always determined to be null based on the update function parameter validation.

Relevant log output

$ sfcc-ci sandbox:update -s xxxxxxxx --stop-scheduler '{"weekdays":["MONDAY","TUESDAY","WEDNESDAY","THURSDAY","FRIDAY"],"time":"23:00:00Z"}' -D
...

REQUEST { auth:
   { bearer:
      '....' },
  json: true,
  uri:
   'https://admin.dx.commercecloud.salesforce.com/api/v1/sandboxes/xxxxxxxxxxx',
  method: 'PATCH',
  body: { autoScheduled: false },
  callback: [Function] }

....

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions