@@ -8,14 +8,15 @@ var assign = require('lodash.assign');
88 * @method waitfor
99 * @description Wait for the machine with the given id to enter a certain machine
1010 * state. This action polls the server and returns only when we detect that the machine
11- * has transitioned into the given state. States available are:
11+ * has transitioned into the given state. States available to check for are:
1212 * - off
13- * - ready
13+ * - serviceready - services are running on the machine but the Paperspace agent is not yet available
14+ * - ready - services are running on machine and the Paperspace agent is ready to stream or accept logins
1415 *
1516 * When the callback is called, the returned object will be information about the machine.
1617 * @param {object } params - Machine waitfor parameters
1718 * @param {string } params.machineId - Id of the machine to wait for
18- * @param {string } params.state - Name of the state to wait for
19+ * @param {string } params.state - Name of the state to wait for, either 'off', 'serviceready', 'ready'
1920 * @param {function } cb - Node-style error-first callback function
2021 * @returns {object } machine - The machine JSON object
2122 * @example
@@ -53,6 +54,7 @@ var assign = require('lodash.assign');
5354 * "agentType": "WindowsDesktop",
5455 * "dtCreated": "2016-11-18T05:18:29.533Z",
5556 * "state": "ready",
57+ * "updatesPending": false,
5658 * "networkId": "n789ghi",
5759 * "privateIpAddress": "10.64.21.47",
5860 * "publicIpAddress": null,
@@ -74,11 +76,12 @@ function waitfor(params, cb) {
7476 var targetState ;
7577 switch ( state ) {
7678 case 'ready' :
79+ case 'serviceready' :
7780 case 'off' :
7881 targetState = state ;
7982 break ;
8083 default :
81- return cb ( new Error ( 'state must be either off or ready' ) ) ;
84+ return cb ( new Error ( 'state must be either off, serviceready, or ready' ) ) ;
8285 }
8386 return method ( waitfor , params , function _cb ( err , machine ) {
8487 if ( err ) {
0 commit comments