From a665bf94ac326c1b39fe2b683b06524a2233c9aa Mon Sep 17 00:00:00 2001 From: Balaji Krishnan Date: Mon, 13 Mar 2017 16:40:21 -0700 Subject: [PATCH] slight improvements to generated code for template deployment. --- src/codegen/codgen.template-deploy.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/codegen/codgen.template-deploy.js b/src/codegen/codgen.template-deploy.js index 0011aae..1f84390 100644 --- a/src/codegen/codgen.template-deploy.js +++ b/src/codegen/codgen.template-deploy.js @@ -6,7 +6,6 @@ const deployTemplateFunctionName = 'deployTemplate'; exports.deployTemplate = function deployTemplate() { var text = `function ${deployTemplateFunctionName}(credentials, callback){\ // TODO: initialize these variables - var subscriptionId;\ var resourceGroupName;\ var deploymentName;\ var templateFilePath;\ @@ -23,7 +22,7 @@ exports.deployTemplate = function deployTemplate() { template = JSON.parse(fs.readFileSync(templateFilePath));\ templateParameters = JSON.parse(fs.readFileSync(templateParametersFilePath));\ } catch (error) {\ - console.error('Encountered error parsing template file:', error);\ + callback(error);\ }\ \r\n var resourceClient = new ResourceManagement.ResourceManagementClient(credentials, subscriptionId);\ @@ -39,7 +38,10 @@ exports.generateRequireStatements = function generateRequireStatements(document) }; exports.deployTemplateCallSite = function deployTemplateCallSite() { - var text = `${deployTemplateFunctionName}(credentials, function(err, result){ });`; + var text = `${deployTemplateFunctionName}(credentials, function(err, result){\ + if(err) return console.log(err);\ + console.log('template deployed to azure!');\ + });`; return codegenerator.generateCode(text); };