Skip to content

Commit

Permalink
Users/arjgupta/errortowarning master 3 (#4392)
Browse files Browse the repository at this point in the history
* is xml transformation is not applied properly, then instead of throwing, we warn

* will not show transformation applied successfully message if transformations is not applied

* updated patch version of iis on mg task

* splitting xml transformation error string into 3 resources

* minor changes
  • Loading branch information
arjgupta authored May 24, 2017
1 parent bf02a35 commit bfb8349
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,9 @@
"loc.messages.InvalidPollOption": "Invalid polling option provided: %s.",
"loc.messages.MissingAppTypeWebConfigParameters": "Attribute '-appType' is missing in the Web.config parameters. Valid values for '-appType' are: 'python_Bottle', 'python_Django', 'python_Flask' and 'node'.<br />For example, '-appType python_Bottle' (sans-quotes) in case of Python Bottle framework..",
"loc.messages.AutoDetectDjangoSettingsFailed": "Unable to detect DJANGO_SETTINGS_MODULE 'settings.py' file path. Ensure that the 'settings.py' file exists or provide the correct path in Web.config parameter input in the following format '-DJANGO_SETTINGS_MODULE <folder_name>.settings'",
"loc.messages.FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following. \n1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. \n2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"loc.messages.FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following.",
"loc.messages.FailedToApplyTransformationReason1": "1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. ",
"loc.messages.FailedToApplyTransformationReason2": "2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"loc.messages.AutoParameterizationMessage": "ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation.",
"loc.messages.UnsupportedAppType": "App type '%s' not supported in Web.config generation. Valid values for '-appType' are: 'python_Bottle', 'python_Django', 'python_Flask' and 'node'"
}
4 changes: 3 additions & 1 deletion Tasks/AzureRmWebAppDeployment/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,9 @@
"InvalidPollOption": "Invalid polling option provided: %s.",
"MissingAppTypeWebConfigParameters": "Attribute '-appType' is missing in the Web.config parameters. Valid values for '-appType' are: 'python_Bottle', 'python_Django', 'python_Flask' and 'node'.<br />For example, '-appType python_Bottle' (sans-quotes) in case of Python Bottle framework..",
"AutoDetectDjangoSettingsFailed": "Unable to detect DJANGO_SETTINGS_MODULE 'settings.py' file path. Ensure that the 'settings.py' file exists or provide the correct path in Web.config parameter input in the following format '-DJANGO_SETTINGS_MODULE <folder_name>.settings'",
"FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following. \n1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. \n2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following.",
"FailedToApplyTransformationReason1": "1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. ",
"FailedToApplyTransformationReason2": "2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"AutoParameterizationMessage": "ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation.",
"UnsupportedAppType": "App type '%s' not supported in Web.config generation. Valid values for '-appType' are: 'python_Bottle', 'python_Django', 'python_Flask' and 'node'"
}
Expand Down
4 changes: 3 additions & 1 deletion Tasks/AzureRmWebAppDeployment/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,9 @@
"MissingAppTypeWebConfigParameters": "ms-resource:loc.messages.MissingAppTypeWebConfigParameters",
"AutoDetectDjangoSettingsFailed": "ms-resource:loc.messages.AutoDetectDjangoSettingsFailed",
"FailedToApplyTransformation": "ms-resource:loc.messages.FailedToApplyTransformation",
"FailedToApplyTransformationReason1": "ms-resource:loc.messages.FailedToApplyTransformationReason1",
"FailedToApplyTransformationReason2": "ms-resource:loc.messages.FailedToApplyTransformationReason2",
"AutoParameterizationMessage": "ms-resource:loc.messages.AutoParameterizationMessage",
"UnsupportedAppType": "ms-resource:loc.messages.UnsupportedAppType"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ export function fileTransformations(isFolderBasedDeployment: boolean, JSONFiles:
if(environmentName && environmentName != 'Release') {
transformConfigs.push(environmentName + ".config");
}
xdtTransformationUtility.basicXdtTransformation(folderPath, transformConfigs);
console.log(tl.loc("XDTTransformationsappliedsuccessfully"));
var isTransformationApplied: boolean = xdtTransformationUtility.basicXdtTransformation(folderPath, transformConfigs);

if(isTransformationApplied)
{
console.log(tl.loc("XDTTransformationsappliedsuccessfully"));
}

}
else {
throw new Error(tl.loc("CannotPerformXdtTransformationOnNonWindowsPlatform"));
Expand Down
8 changes: 6 additions & 2 deletions Tasks/Common/webdeployment-common/xdttransformationutility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function applyXdtTransformation(sourceFile, transformFile) {
* @param transformConfigs The array of transform config names, ex : ["Release.config", "EnvName.config"]
*
*/
export function basicXdtTransformation(rootFolder, transformConfigs) {
export function basicXdtTransformation(rootFolder, transformConfigs): boolean {
var sourceXmlFiles = expandWildcardPattern(rootFolder, '**/*.config');
var isTransformationApplied = false;
Object.keys(sourceXmlFiles).forEach( function(sourceXmlFile) {
Expand All @@ -59,6 +59,10 @@ export function basicXdtTransformation(rootFolder, transformConfigs) {
});
});
if(!isTransformationApplied) {
throw new Error(tl.loc('FailedToApplyTransformation'));
tl.warning(tl.loc('FailedToApplyTransformation'));
tl.warning(tl.loc('FailedToApplyTransformationReason1'));
tl.warning(tl.loc('FailedToApplyTransformationReason2'));
}

return isTransformationApplied;
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@
"loc.messages.EncodeNotSupported": "Detected file encoding of the file %s as %s. Variable substitution is not supported with file encoding %s. Supported encodings are UTF-8 and UTF-16 LE.",
"loc.messages.UnknownFileEncodeError": "Unable to detect encoding of the file %s (typeCode: %s). Supported encodings are UTF-8 and UTF-16 LE.",
"loc.messages.ShortFileBufferError": "File buffer is too short to detect encoding type : %s",
"loc.messages.FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following. \n1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. \n2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"loc.messages.FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following.",
"loc.messages.FailedToApplyTransformationReason1": "1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. ",
"loc.messages.FailedToApplyTransformationReason2": "2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"loc.messages.AutoParameterizationMessage": "ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation."
}
6 changes: 4 additions & 2 deletions Tasks/IISWebAppDeploymentOnMachineGroup/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"version": {
"Major": 0,
"Minor": 0,
"Patch": 17
"Patch": 18
},
"demands": [],
"minimumAgentVersion": "2.104.1",
Expand Down Expand Up @@ -176,7 +176,9 @@
"EncodeNotSupported": "Detected file encoding of the file %s as %s. Variable substitution is not supported with file encoding %s. Supported encodings are UTF-8 and UTF-16 LE.",
"UnknownFileEncodeError": "Unable to detect encoding of the file %s (typeCode: %s). Supported encodings are UTF-8 and UTF-16 LE.",
"ShortFileBufferError": "File buffer is too short to detect encoding type : %s",
"FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following. \n1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. \n2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"FailedToApplyTransformation": "Unable to apply transformation for the given package. Verify the following.",
"FailedToApplyTransformationReason1": "1. Whether the Transformation is already applied for the MSBuild generated package during build. If yes, remove the <DependentUpon> tag for each config in the csproj file and rebuild. ",
"FailedToApplyTransformationReason2": "2. Ensure that the config file and transformation files are present in the same folder inside the package.",
"AutoParameterizationMessage": "ConnectionString attributes in Web.config is parameterized by default. Note that the transformation has no effect on connectionString attributes as the value is overridden during deployment by 'Parameters.xml or 'SetParameters.xml' files. You can disable the auto-parameterization by setting /p:AutoParameterizationWebConfigConnectionStrings=False during MSBuild package generation."
}
}
4 changes: 3 additions & 1 deletion Tasks/IISWebAppDeploymentOnMachineGroup/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"version": {
"Major": 0,
"Minor": 0,
"Patch": 17
"Patch": 18
},
"demands": [],
"minimumAgentVersion": "2.104.1",
Expand Down Expand Up @@ -179,6 +179,8 @@
"UnknownFileEncodeError": "ms-resource:loc.messages.UnknownFileEncodeError",
"ShortFileBufferError": "ms-resource:loc.messages.ShortFileBufferError",
"FailedToApplyTransformation": "ms-resource:loc.messages.FailedToApplyTransformation",
"FailedToApplyTransformationReason1": "ms-resource:loc.messages.FailedToApplyTransformationReason1",
"FailedToApplyTransformationReason2": "ms-resource:loc.messages.FailedToApplyTransformationReason2",
"AutoParameterizationMessage": "ms-resource:loc.messages.AutoParameterizationMessage"
}
}

0 comments on commit bfb8349

Please sign in to comment.