Skip to content

Instantly share code, notes, and snippets.

@adamv
Created August 19, 2015 22:29
Show Gist options
  • Save adamv/b97aa9363a90378394b9 to your computer and use it in GitHub Desktop.
Save adamv/b97aa9363a90378394b9 to your computer and use it in GitHub Desktop.
When the run-if boostrap action doesn't work...
check_if_master() {
python - <<'__SCRIPT__'
import sys
import json
instance_file = "/mnt/var/lib/info/instance.json"
with open(instance_file) as f:
props = json.load(f)
is_master = props.get('isMaster', False)
if is_master:
sys.exit(0)
else:
sys.exit(1)
__SCRIPT__
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment