<commit_before>import json
import os
import sys
from subprocess import PIPE

import petname

from conjureup import controllers, juju, utils
from conjureup.api.models import model_info
from conjureup.app_config import app

from . import common


class NewCloudController:

    def __init__(self):
        self.cloud = None

    def do_post_bootstrap(self):
        """ runs post bootstrap script if exists
        """
        # Set provider type for post-bootstrap
        app.env['JUJU_PROVIDERTYPE'] = model_info('default')['provider-type']

        post_bootstrap_sh = os.path.join(app.config['spell-dir'],
                                         'steps/00_post-bootstrap')
        if os.path.isfile(post_bootstrap_sh) \
           and os.access(post_bootstrap_sh, os.X_OK):
            utils.pollinate(app.session_id, 'J001')
            utils.info("Running post-bootstrap tasks.")
            try:
                sh = utils.run(post_bootstrap_sh, shell=True,
                               stdout=PIPE,
                               stderr=PIPE,
                               env=app.env)
                result = json.loads(sh.stdout.decode('utf8'))
                utils.info("Finished post bootstrap task: {}".format(
                    result['message']))
            except Exception as e:
                utils.warning(
                    "Failed to run post bootstrap task: {}".format(e))
                sys.exit(1)
<commit_msg>Fixes #466<commit_after>import json
import os
import sys
from subprocess import PIPE

import petname

from conjureup import controllers, juju, utils
from conjureup.api.models import model_info
from conjureup.app_config import app

from . import common


class NewCloudController:

    def __init__(self):
        self.cloud = None

    def do_post_bootstrap(self):
        """ runs post bootstrap script if exists
        """
        # Set provider type for post-bootstrap
        info = model_info(app.current_model)
        app.env['JUJU_PROVIDERTYPE'] = info['provider-type']

        post_bootstrap_sh = os.path.join(app.config['spell-dir'],
                                         'steps/00_post-bootstrap')
        if os.path.isfile(post_bootstrap_sh) \
           and os.access(post_bootstrap_sh, os.X_OK):
            utils.pollinate(app.session_id, 'J001')
            utils.info("Running post-bootstrap tasks.")
            try:
                sh = utils.run(post_bootstrap_sh, shell=True,
                               stdout=PIPE,
                               stderr=PIPE,
                               env=app.env)
                result = json.loads(sh.stdout.decode('utf8'))
                utils.info("Finished post bootstrap task: {}".format(
                    result['message']))
            except Exception as e:
                utils.warning(
                    "Failed to run post bootstrap task: {}".format(e))
                sys.exit(1)

{'fraction_non_alphanumeric': 0.09358930407953377, 'fraction_numerical': 0.005827905382242029, 'mean_word_length': 1.7685009487666035, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2632675', 'n_tokens_mistral': 805, 'n_tokens_neox': 768, 'n_words': 185}