Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing #1015539 #4628

Merged
merged 14 commits into from
Jul 3, 2017
Merged

Conversation

aydey
Copy link
Contributor

@aydey aydey commented Jun 23, 2017

No description provided.

@@ -397,6 +397,11 @@ export class WinRMExtensionHelper {
reject(tl.loc("ARG_SetExtensionFailedForVm", this.resourceGroupName, vmName, result));
return;
}
if (!this.ValidateExtensionExecutionStatus(vmName, dnsName, extensionName, location, _fileUris)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

await here

@@ -345,7 +345,7 @@ export class WinRMExtensionHelper {
if (result["properties"]["instanceView"] && result["properties"]["instanceView"]["extensions"]) {
var extensions = result["properties"]["instanceView"]["extensions"];
for (var extension of extensions) {
if (result["name"] === extensionName) {
if (extension["name"] === extensionName) {
for (var substatus of extension["substatuses"]) {
if (substatus["code"] && substatus["code"].indexOf("ComponentStatus/StdErr") >= 0 && !!substatus["message"] && substatus["message"] != "") {
invalidExecutionStatus = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider returning success only if you find the matching extension

return;
}
var validStatus = await this.ValidateExtensionExecutionStatus(vmName, dnsName, extensionName, location, _fileUris);
if (!validStatus) {
tl.debug("WinRMCustomScriptExtension is not valid on vm " + vmName);
reject(tl.loc("ARG_SetExtensionFailedForVm", this.resourceGroupName, vmName, result));
reject(tl.loc("ARG_SetExtensionFailedForVm", this.resourceGroupName, vmName, JSON.stringify(result)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it make sense here. I think we should attempt to print the stderr result message

}
}
try {
await this.ValidateExtensionExecutionStatus(vmName, dnsName, extensionName, location, _fileUris);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might return success in some cases.

if (result["properties"]["instanceView"] && result["properties"]["instanceView"]["extensions"]) {
var extensions = result["properties"]["instanceView"]["extensions"];
for (var extension of extensions) {
if (result["name"] === extensionName) {
if (extension["name"] === extensionName) {
for (var substatus of extension["substatuses"]) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the extension is not found, you should fail with the message.

@@ -345,7 +345,7 @@
"SecurityRuleNameCannotBeNull": "securityRuleName cannot be null or undefined and it must be of type string.",
"SecurityRuleParametersCannotBeNull": "securityRuleParameters cannot be null or undefined.",
"OutputVariableShouldNotBeEmpty": "Output variable should not be empty.",
"ARG_SetExtensionFailedForVm": "Failed to set extension on Virtual Machine %s of Resource Group %s with result: %s",
"ARG_SetExtensionFailedForVm": "StdErr Message: Failed to set extension on Virtual Machine %s of Resource Group %s with error: %s",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Standard Error:

@@ -321,49 +328,63 @@ export class WinRMExtensionHelper {

private GetExtension(vmName: string, extensionName: string): Promise<any> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to getCustomScriptExtension and remove the extensionName param

break;
}
}
break;
}
}
}
if(!extensionPresent){
reject("Extension not found on the vm: " + vmName);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this can show without debug; then it needs to be in task.json

@@ -388,13 +409,21 @@ export class WinRMExtensionHelper {
return new Promise<any>((resolve, reject) => {
this.computeClient.virtualMachineExtensions.createOrUpdate(this.resourceGroupName, vmName, az.ComputeResourceType.VirtualMachine, extensionName, parameters, async (error, result, request, response) => {
if (error) {
reject(tl.loc("CreationOfExtensionFailed", utils.getError(error)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if you should add the VM name to the message.

@aydey aydey merged commit 1039402 into master Jul 3, 2017
@bryanmacfarlane bryanmacfarlane deleted the users/aydey/AzureRG/CustomScriptExtensionBugFixes branch January 31, 2018 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants