@@ -10,6 +10,8 @@ module.exports = function stop(args) {
1010 let bsConfigPath = utils . getConfigPath ( args . cf ) ;
1111
1212 return utils . validateBstackJson ( bsConfigPath ) . then ( function ( bsConfig ) {
13+ utils . setDefaults ( bsConfig , args ) ;
14+
1315 // accept the username from command line if provided
1416 utils . setUsername ( bsConfig , args ) ;
1517
@@ -30,7 +32,7 @@ module.exports = function stop(args) {
3032 password : bsConfig . auth . access_key ,
3133 } ,
3234 headers : {
33- " User-Agent" : utils . getUserAgent ( ) ,
35+ ' User-Agent' : utils . getUserAgent ( ) ,
3436 } ,
3537 } ;
3638
@@ -46,16 +48,16 @@ module.exports = function stop(args) {
4648
4749 logger . info ( message ) ;
4850 } else {
49- let build = null
51+ let build = null ;
5052 try {
51- build = JSON . parse ( body )
53+ build = JSON . parse ( body ) ;
5254 } catch ( error ) {
53- build = null
55+ build = null ;
5456 }
5557
5658 if ( resp . statusCode == 299 ) {
5759 messageType = Constants . messageTypes . INFO ;
58- errorCode = " api_deprecated" ;
60+ errorCode = ' api_deprecated' ;
5961
6062 if ( build ) {
6163 message = build . message ;
@@ -66,14 +68,14 @@ module.exports = function stop(args) {
6668 }
6769 } else if ( resp . statusCode != 200 ) {
6870 messageType = Constants . messageTypes . ERROR ;
69- errorCode = " api_failed_build_stop" ;
71+ errorCode = ' api_failed_build_stop' ;
7072
7173 if ( build ) {
7274 message = `${
7375 Constants . userMessages . BUILD_STOP_FAILED
7476 } with error: \n${ JSON . stringify ( build , null , 2 ) } `;
7577 logger . error ( message ) ;
76- if ( build . message === " Unauthorized" ) errorCode = " api_auth_failed" ;
78+ if ( build . message === ' Unauthorized' ) errorCode = ' api_auth_failed' ;
7779 } else {
7880 message = Constants . userMessages . BUILD_STOP_FAILED ;
7981 logger . error ( message ) ;
@@ -85,7 +87,7 @@ module.exports = function stop(args) {
8587 }
8688 }
8789 utils . sendUsageReport ( bsConfig , args , message , messageType , errorCode ) ;
88- } )
90+ } ) ;
8991 } ) . catch ( function ( err ) {
9092 logger . error ( err ) ;
9193 utils . setUsageReportingFlag ( null , args . disableUsageReporting ) ;
0 commit comments