comparison piecrust/main.py @ 1016:c4cfbbeed72e

chef: Fix crash for commands run outside of a website.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 29 Nov 2017 20:38:15 -0800
parents 8adc27285d93
children 40228511d600
comparison
equal deleted inserted replaced
1015:fa489c5e829e 1016:c4cfbbeed72e
314 if not hasattr(result, 'func'): 314 if not hasattr(result, 'func'):
315 parser.print_help() 315 parser.print_help()
316 return 0 316 return 0
317 317
318 # Add some timing information. 318 # Add some timing information.
319 app.env.stats.registerTimer('ChefStartup') 319 if app.env:
320 app.env.stats.stepTimerSince('ChefStartup', _chef_start_time) 320 app.env.stats.registerTimer('ChefStartup')
321 app.env.stats.stepTimerSince('ChefStartup', _chef_start_time)
321 322
322 # Run the command! 323 # Run the command!
323 ctx = CommandContext(appfactory, app, parser, result) 324 ctx = CommandContext(appfactory, app, parser, result)
324 exit_code = result.func(ctx) 325 exit_code = result.func(ctx)
325 if exit_code is None: 326 if exit_code is None: