<commit_before>#!/usr/bin/python

import json
import subprocess
import sys
import time
import os


def check_status(password, opsman, identifier):
    cmd = "om -k -u admin -p {0} -t {1} curl -p /api/v0/installations".format(
        password, opsman
    )

    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    out_bytes, err_bytes = p.communicate()
    out = out_bytes.decode("utf-8").strip()
    if p.returncode != 0:
        sys.exit(p.returncode)

    settings = json.loads(out)

    for setting in settings['installations']:
        status = [a for a in setting['additions'] if a['identifier'] == identifier]
        if len(status) > 0:
            return setting['status']

    return None


def main(argv):
    opsman = "https://opsman.{}".format(os.environ['AWS_CF_DOMAIN'])
    password = os.environ['AWS_CF_PASSWORD']

    status = None
    while (status == "running") or not status:
        status = check_status(password, opsman, "p-bosh")
        if status == "failed":
            print("p-bosh install failed")
            sys.exit(1)
        elif status == "succeeded":<commit_msg>Useful output on curl failure<commit_after>#!/usr/bin/python

import json
import subprocess
import sys
import time
import os


def check_status(password, opsman, identifier):
    cmd = "om -k -u admin -p {0} -t {1} curl -p /api/v0/installations".format(
        password, opsman
    )

    p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    out_bytes, err_bytes = p.communicate()
    out = out_bytes.decode("utf-8").strip()
    if p.returncode != 0:
        print("curling opsman status failed")
        sys.exit(p.returncode)

    settings = json.loads(out)

    for setting in settings['installations']:
        status = [a for a in setting['additions'] if a['identifier'] == identifier]
        if len(status) > 0:
            return setting['status']

    return None


def main(argv):
    opsman = "https://opsman.{}".format(os.environ['AWS_CF_DOMAIN'])
    password = os.environ['AWS_CF_PASSWORD']

    status = None
    while (status == "running") or not status:
        status = check_status(password, opsman, "p-bosh")
        if status == "failed":
            print("p-bosh install failed")
            sys.exit(1)
        elif status == "succeeded":
{'fraction_non_alphanumeric': 0.1360136869118905, 'fraction_numerical': 0.005988023952095809, 'mean_word_length': 2.85337726523888, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4395359', 'n_tokens_mistral': 767, 'n_tokens_neox': 748, 'n_words': 193}