forked from ging/fiware-idm-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
58 lines (48 loc) · 2.14 KB
/
fabfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Copyright (C) 2014 Universidad Politecnica de Madrid
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from deployment import keystone
from deployment import horizon
from deployment import migration
from conf import settings
from fabric.api import task
from fabric.operations import local as lrun
from fabric.colors import red,green
@task
def localhost():
"""DEPRECATED. Executing tasks in remote hosts is no longer supported.
Therefore, localhost task is no longer required. Call the tasks directly."""
print localhost.__doc__
def set_up(dev=False):
"""Install system and python dependencies."""
_install_dependencies()
def _install_dependencies():
command = settings.UBUNTU_DEPENDENCIES['install_command']
dependencies = ' '.join(settings.UBUNTU_DEPENDENCIES['dependencies'])
lrun('{command} {dependencies}'.format(command=command,
dependencies=dependencies))
print 'Dependencies correctly installed'
@task
def update_all(keystone_path=settings.KEYSTONE_ROOT, horizon_path=settings.HORIZON_ROOT):
"""Update both the Front and the Back-end, as well as their dependencies."""
update1_ok = keystone.update(keystone_path)
update2_ok = horizon.update(horizon_path)
if not update1_ok or not update2_ok:
print red('\nUpdate finished, but some errors were found.\nPlease check the logs and make any necessary fixes.')
else:
print(green('Everything up to date!'))
@task
def check_all(keystone_path=settings.KEYSTONE_ROOT, horizon_path=settings.HORIZON_ROOT):
"""Run several checks both in the Front and in the Back-end."""
keystone.check(keystone_path)
horizon.instance.run(horizon_path=horizon_path)