Beispiel #1
0
def git_clone(upstream, release):
    """ Clones a repo and checkout revision
    FIXME: Should go away and maybe put in another runtime layer
    """
    clone_cmd = ['git', 'clone', '-q', upstream, node_dist_dir()]
    checkout_cmd = ['git', 'checkout', release]
    apt_install(['git'])
    if os.path.isdir(node_dist_dir()):
        rmtree(node_dist_dir())
    try:
        hookenv.log("Cloning: {}".format(clone_cmd), 'debug')
        check_call(clone_cmd)
        os.chdir(node_dist_dir())
        hookenv.log("Checking out revision: {}".format(checkout_cmd), 'debug')
        check_call(checkout_cmd)
    except CalledProcessError as e:
        hookenv.status_set('blocked', "Problem with git: {}".format(e))
        sys.exit(1)
def git_clone(upstream, release):
    """ Clones a repo and checkout revision
    FIXME: Should go away and maybe put in another runtime layer
    """
    clone_cmd = ['git', 'clone', '-q',
                 upstream, node_dist_dir()]
    checkout_cmd = ['git', 'checkout', release]
    apt_install(['git'])
    if os.path.isdir(node_dist_dir()):
        rmtree(node_dist_dir())
    try:
        hookenv.log("Cloning: {}".format(clone_cmd), 'debug')
        check_call(clone_cmd)
        os.chdir(node_dist_dir())
        hookenv.log("Checking out revision: {}".format(checkout_cmd), 'debug')
        check_call(checkout_cmd)
    except CalledProcessError as e:
        hookenv.status_set('blocked',
                           "Problem with git: {}".format(e))
        sys.exit(1)
def render_config():
    config = hookenv.config()
    # Writes configuration
    ctx = {
        'irc_server': config['ircanywhere-server'],
        'port': config['ircanywhere-port'],
        'realname': config['ircanywhere-realname'],
        'password': config['ircanywhere-password']
    }
    hookenv.status_set('maintenance',
                       'Rendering IRCAnywhere config: {}'.format(ctx))
    render(source='config.js',
           target=os.path.join(node_dist_dir(), 'config.js'),
           context=ctx)
Beispiel #4
0
def render_config():
    config = hookenv.config()
    # Writes configuration
    ctx = {
        'irc_server': config['ircanywhere-server'],
        'port': config['ircanywhere-port'],
        'realname': config['ircanywhere-realname'],
        'password': config['ircanywhere-password']
    }
    hookenv.status_set('maintenance',
                       'Rendering IRCAnywhere config: {}'.format(ctx))
    render(source='config.js',
           target=os.path.join(node_dist_dir(), 'config.js'),
           context=ctx)
Beispiel #5
0
def start_app():
    config = hookenv.config()

    hookenv.status_set('maintenance', 'Starting IRCAnywhere application')

    # Render upstart job
    ctx = {'dist_dir': node_dist_dir()}
    render(source='ircanywhere-upstart.conf',
           target='/etc/init/ircanywhere.conf',
           context=ctx)

    hookenv.status_set('maintenance',
                       'Opening Port {}'.format(config['ircanywhere-port']))
    hookenv.open_port(config['nginx-port'])
    hookenv.status_set('active', 'ready')
    set_state('nginx.start')
def start_app():
    config = hookenv.config()

    hookenv.status_set('maintenance', 'Starting IRCAnywhere application')

    # Render upstart job
    ctx = {
        'dist_dir': node_dist_dir()
    }
    render(source='ircanywhere-upstart.conf',
           target='/etc/init/ircanywhere.conf',
           context=ctx)

    hookenv.status_set('maintenance',
                       'Opening Port {}'.format(config['ircanywhere-port']))
    hookenv.open_port(config['nginx-port'])
    hookenv.status_set('active', 'ready')
    set_state('nginx.start')