mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-25 05:59:26 +08:00
Check for error from Azure when using the private-cluster feature (#270)
* Check for error from Azure Move the error check for Azure earlier, so that a well defined error is thrown on error instead of a JSONSyntax error. The issue is that when Azure returns an error, like when there's an issue with the access to the principal used. When this happens, the stdout field will be an empty string, and the error message will be set. * Restore check for deserialized exitCode
This commit is contained in:
@@ -75,11 +75,18 @@ export class PrivateKubectl extends Kubectl {
|
||||
runOutput
|
||||
)}`
|
||||
)
|
||||
|
||||
if (runOutput.exitCode !== 0) {
|
||||
throw Error(
|
||||
`Call to private cluster failed. Command: '${kubectlCmd}', errormessage: ${runOutput.stderr}`
|
||||
)
|
||||
}
|
||||
|
||||
const runObj: {logs: string; exitCode: number} = JSON.parse(
|
||||
runOutput.stdout
|
||||
)
|
||||
if (!silent) core.info(runObj.logs)
|
||||
if (runOutput.exitCode !== 0 && runObj.exitCode !== 0) {
|
||||
if (runObj.exitCode !== 0) {
|
||||
throw Error(`failed private cluster Kubectl command: ${kubectlCmd}`)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user