Skip to content

Instantly share code, notes, and snippets.

@Gordonei
Last active December 11, 2018 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gordonei/06a624f7da93382efb70e25d780a1052 to your computer and use it in GitHub Desktop.
Save Gordonei/06a624f7da93382efb70e25d780a1052 to your computer and use it in GitHub Desktop.
Script for finding invalid YAML config files that might be borking your rails console from starting up
#!/usr/bin/env bash
SEARCH_ROOT=/opt/gitlab/
find "$SEARCH_ROOT" -name *.yml | while read line; do echo $line | ruby -e "require 'yaml';filename=STDIN.read.strip; YAML.load_file filename; puts filename"; done
@Gordonei
Copy link
Author

When loading up the gitlab rails console, I was getting a YAML parsing error (mapping values are not allowed in this context at line x column y (Psych::SyntaxError)).

Wrote this script to help me track it down - it finds all YAML files, and tries to load them one by one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment