Skip to main content

Restart interpreter

You can restart a machine as part of a job using the Restart interpreter. The machine_reboot command can be a step in any order of the job’s list of steps. The Courier Runner keeps track of the job across the restart and then reports the job status back when it completes.

You can use the exec command in your Courier job definition for both Linux and Windows machine restarts. The syntax is as follows:

"command": {
    "exec": ["machine_reboot"]
}

Example

The following Courier job restarts a node:

{
    "name": "a sample job",
    "description": "A simple job to demonstrate a machine restart",
    "scheduleRule": "immediate",
    "exceptionRules": [],
    "target": {
        "executionType": "sequential",
        "groups": [{
            "timeoutSeconds": 160,
            "batchSize": {
                "type": "number",
                "value": 1
            },
            "distributionMethod": "rolling",
            "successCriteria": [{ "numRuns": { "type": "percent", "value": 100 }, "status": "success" }],
            "nodeListType":"nodes",
            "nodeIdentifiers": [ "--NODE1--" ]
        }]
    },
    "actions": {
        "accessMode": "agent",
        "steps": [{
            "interpreter": {
                "skill": {
                    "minVersion": "1.0.0"
                },
                "name": "chef-platform/restart-interpreter"
            },
            "command": {
                "exec": ["machine_reboot"]
            },
            "inputs": { },
            "expectedInputs": { },
            "outputFieldRules": { },
            "retryCount": 2,
            "failureBehavior": {
                "action": "retryThenFail",
                "retryBackoffStrategy": {
                    "name": "none",
                    "delaySeconds": 0,
                    "arguments": [1,3,5]
                }
            },
            "limits": { },
            "conditions": [ ]
        }]
    }
}

Thank you for your feedback!

×