@@ -10,6 +10,8 @@ module.exports = function stop(args) {
10
10
let bsConfigPath = utils . getConfigPath ( args . cf ) ;
11
11
12
12
return utils . validateBstackJson ( bsConfigPath ) . then ( function ( bsConfig ) {
13
+ utils . setDefaults ( bsConfig , args ) ;
14
+
13
15
// accept the username from command line if provided
14
16
utils . setUsername ( bsConfig , args ) ;
15
17
@@ -30,7 +32,7 @@ module.exports = function stop(args) {
30
32
password : bsConfig . auth . access_key ,
31
33
} ,
32
34
headers : {
33
- " User-Agent" : utils . getUserAgent ( ) ,
35
+ ' User-Agent' : utils . getUserAgent ( ) ,
34
36
} ,
35
37
} ;
36
38
@@ -46,16 +48,16 @@ module.exports = function stop(args) {
46
48
47
49
logger . info ( message ) ;
48
50
} else {
49
- let build = null
51
+ let build = null ;
50
52
try {
51
- build = JSON . parse ( body )
53
+ build = JSON . parse ( body ) ;
52
54
} catch ( error ) {
53
- build = null
55
+ build = null ;
54
56
}
55
57
56
58
if ( resp . statusCode == 299 ) {
57
59
messageType = Constants . messageTypes . INFO ;
58
- errorCode = " api_deprecated" ;
60
+ errorCode = ' api_deprecated' ;
59
61
60
62
if ( build ) {
61
63
message = build . message ;
@@ -66,14 +68,14 @@ module.exports = function stop(args) {
66
68
}
67
69
} else if ( resp . statusCode != 200 ) {
68
70
messageType = Constants . messageTypes . ERROR ;
69
- errorCode = " api_failed_build_stop" ;
71
+ errorCode = ' api_failed_build_stop' ;
70
72
71
73
if ( build ) {
72
74
message = `${
73
75
Constants . userMessages . BUILD_STOP_FAILED
74
76
} with error: \n${ JSON . stringify ( build , null , 2 ) } `;
75
77
logger . error ( message ) ;
76
- if ( build . message === " Unauthorized" ) errorCode = " api_auth_failed" ;
78
+ if ( build . message === ' Unauthorized' ) errorCode = ' api_auth_failed' ;
77
79
} else {
78
80
message = Constants . userMessages . BUILD_STOP_FAILED ;
79
81
logger . error ( message ) ;
@@ -85,7 +87,7 @@ module.exports = function stop(args) {
85
87
}
86
88
}
87
89
utils . sendUsageReport ( bsConfig , args , message , messageType , errorCode ) ;
88
- } )
90
+ } ) ;
89
91
} ) . catch ( function ( err ) {
90
92
logger . error ( err ) ;
91
93
utils . setUsageReportingFlag ( null , args . disableUsageReporting ) ;
0 commit comments