コード例 #1
0
def finish_instance_creation(label):
    call(["systemctl", "daemon-reload"])
    call(["systemctl", "enable", "platform-{}".format(label)])
    call(["systemctl", "start", "platform-{}".format(label)])
    requests.post("http://127.0.0.1:5000/callback/instance-created", {"label": label})
    Nginx.rebuild()
    call(["systemctl", "restart", "nginx"])
コード例 #2
0
def destroy_instance(id):
    instance = AppInstance.query.get(id)
    label = instance.label
    call(['systemctl', 'stop', 'platform-{}'.format(label)])
    call(['systemctl', 'disable', 'platform-{}'.format(label)])
    if os.path.isfile('/etc/systemd/system/platform-{}.service'.format(label)):
        os.remove('/etc/systemd/system/platform-{}.service'.format(label))
    if os.path.isdir('/opt/platform/apps/{}'.format(label)):
        shutil.rmtree('/opt/platform/apps/{}'.format(label))
    db.session.delete(instance)
    db.session.commit()
    Nginx.rebuild()
    call(["systemctl", "restart", "nginx"])
    return redirect(url_for('instances'))
コード例 #3
0
ファイル: instances.py プロジェクト: BrixIT/Platform
def destroy_instance(id):
    instance = AppInstance.query.get(id)
    label = instance.label
    call(['systemctl', 'stop', 'platform-{}'.format(label)])
    call(['systemctl', 'disable', 'platform-{}'.format(label)])
    if os.path.isfile('/etc/systemd/system/platform-{}.service'.format(label)):
        os.remove('/etc/systemd/system/platform-{}.service'.format(label))
    if os.path.isdir('/opt/platform/apps/{}'.format(label)):
        shutil.rmtree('/opt/platform/apps/{}'.format(label))
    db.session.delete(instance)
    db.session.commit()
    Nginx.rebuild()
    call(["systemctl", "restart", "nginx"])
    return redirect(url_for('instances'))