Skip to content

Commit aedde3c

Browse files
committed
buildstack_menu: fix error on empty compose-override.yml
Fixes #433 Also improves on exception reporting to include full stacktrace
1 parent 19786e8 commit aedde3c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

scripts/buildstack_menu.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def main():
1111
import math
1212
import sys
1313
import subprocess
14+
import traceback
1415
from deps.chars import specialChars, commonTopBorder, commonBottomBorder, commonEmptyLine, padText
1516
from deps.consts import servicesDirectory, templatesDirectory, volumesDirectory, buildCache, envFile, dockerPathOutput, servicesFileName, composeOverrideFile
1617
from deps.yaml_merge import mergeYaml
@@ -92,7 +93,7 @@ def buildServices(): # TODO: Move this into a dependency so that it can be execu
9293
return True
9394
except Exception as err:
9495
print("Issue running build:")
95-
print(err)
96+
traceback.print_exc()
9697
input("Press Enter to continue...")
9798
return False
9899

@@ -318,7 +319,7 @@ def mainRender(menu, selection, renderType = 1):
318319

319320
except Exception as err:
320321
print("There was an error rendering the menu:")
321-
print(err)
322+
traceback.print_exc()
322323
print("Press [Esc] to go back")
323324
return
324325

@@ -405,13 +406,13 @@ def checkForIssues():
405406
menu[getMenuItemIndexByService(checkedMenuItem)][1]["issues"] = []
406407
except Exception as err:
407408
print("Error running checkForIssues on '%s'" % checkedMenuItem)
408-
print(err)
409+
traceback.print_exc()
409410
input("Press Enter to continue...")
410411
else:
411412
menu[getMenuItemIndexByService(checkedMenuItem)][1]["issues"] = []
412413
except Exception as err:
413414
print("Error running checkForIssues on '%s'" % checkedMenuItem)
414-
print(err)
415+
traceback.print_exc()
415416
input("Press any key to exit...")
416417
sys.exit(1)
417418

@@ -437,7 +438,7 @@ def checkForOptions():
437438
menu[getMenuItemIndexByService(menuItem[0])][1]["buildHooks"]["options"] = True
438439
except Exception as err:
439440
print("Error running checkForOptions on '%s'" % menuItem[0])
440-
print(err)
441+
traceback.print_exc()
441442
input("Press any key to exit...")
442443
sys.exit(1)
443444

@@ -466,7 +467,7 @@ def runPrebuildHook():
466467
exec(code, execGlobals, execLocals)
467468
except Exception as err:
468469
print("Error running PreBuildHook on '%s'" % checkedMenuItem)
469-
print(err)
470+
traceback.print_exc()
470471
input("Press Enter to continue...")
471472
try: # If the prebuild hook modified the docker-compose object, pull it from the script back to here.
472473
dockerComposeServicesYaml = execGlobals["dockerComposeServicesYaml"]
@@ -497,7 +498,7 @@ def runPostBuildHook():
497498
exec(code, execGlobals, execLocals)
498499
except Exception as err:
499500
print("Error running PostBuildHook on '%s'" % checkedMenuItem)
500-
print(err)
501+
traceback.print_exc()
501502
input("Press Enter to continue...")
502503

503504
def executeServiceOptions():

scripts/deps/yaml_merge.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11

22
def mergeYaml(priorityYaml, defaultYaml):
3+
if not priorityYaml:
4+
return defaultYaml
35
finalYaml = {}
46
if isinstance(defaultYaml, dict):
57
for dk, dv in defaultYaml.items():

0 commit comments

Comments
 (0)