forked from cozy/cozy-setup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
804 lines (673 loc) · 21.5 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
import string
import random
import time
from fabric import state
from fabric.api import run, sudo, cd, prompt, task, settings
from fabric.contrib import files
from fabric.colors import green, red
from fabric.context_managers import hide
from fabric.tasks import Task
from fabric.task_utils import crawl
from fabtools import require, python, supervisor, deb, system, nodejs, service
from fabtools.require import file as require_file
'''
Script to set up a cozy cloud environnement from a fresh system
Validated on a Debian squeeze 64 bits up to date.
Once your system is updated, launch
$ fab -H [email protected]:Port install
to install the full Cozy stack.
'''
# Helpers
def id_generator(
size=32,
chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
return ''.join(random.choice(chars) for x in range(size))
def simple_id_generator(size=40, chars=string.ascii_uppercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
USERNAME = id_generator()
PASSWORD = id_generator()
TOKEN = simple_id_generator()
@task
def is_arm():
result = run('lscpu', quiet=True)
return 'arm' in result
def print_failed(module):
print(red('Installation of %s failed.\n' +
'You can join us on our IRC channel: '
+ '#cozycloud on freenode.net to ask for assistance.') % module)
exit()
def cozydo(cmd):
'''Run a command as a cozy user'''
sudo(cmd, user='cozy')
def delete_if_exists(filename):
'''Delete given file if it already exists'''
if files.exists(filename):
sudo('rm -rf %s' % filename)
def su_delete(filename):
'''Delete given file with root permission'''
sudo('rm -rf %s' % filename)
# Tasks
@task
def install():
'''
Install the full cozy stack.
'''
install_tools()
install_node08()
install_couchdb()
install_postfix()
create_cozy_user()
config_couchdb()
install_monitor()
install_controller()
install_indexer()
install_data_system()
install_home()
install_proxy()
#init_domain()
create_cert()
install_nginx()
restart_cozy()
print(green('Cozy installation finished. Now, enjoy !'))
def ask_for_confirmation(module):
'''
Simple function to ask for confirmation before uninstalling a module
installed by the the
'''
confirm = prompt('Are you sure you want to definitely remove %s from your'
' computer? ' % module, default="no")
return confirm == "yes"
@task
def uninstall_all():
'''
Uninstall the whole stack (work in progress)
'''
# TODO remove created users
if ask_for_confirmation("Cozy"):
uninstall_cozy()
if ask_for_confirmation("Node.js"):
uninstall_node08()
if ask_for_confirmation("CouchDB"):
uninstall_couchdb()
if ask_for_confirmation("Postfix"):
uninstall_postfix()
@task
def install_dev():
'''
Install stuff to prepare a virtual machine dedicated to development.
'''
install_tools()
install_node08()
install_couchdb()
install_postfix()
create_cozy_user()
install_monitor()
install_controller_dev()
install_indexer()
install_data_system()
install_home()
install_proxy()
#init_domain()
print(green('The Cozy development environment has been installed.'))
@task
def install_tools():
'''
Install build tools
'''
deb.update_index()
deb.upgrade()
require.deb.packages([
'python',
'python-dev',
'python-setuptools',
'python-pip',
'openssl',
'libssl-dev',
'libxml2-dev',
'libxslt1-dev',
'build-essential',
'git',
'sudo',
'lsb-release',
'imagemagick',
'sqlite3'
])
print(green('Tools successfully installed'))
@task
def install_node08():
'''
Install Node 0.8.18 (0.18.21 for ARM hardwares)
'''
if not is_arm():
require.nodejs.installed_from_source('0.8.18')
print(green('Node 0.8.18 successfully installed'))
else:
version = '0.8.21'
folder = 'node-v%s-linux-arm-pi' % version
filename = folder + '.tar.gz'
require.files.directory('/opt/node', use_sudo=True)
archive_path = 'http://nodejs.org/dist/v%s/%s' % (version, filename)
require_file(url=archive_path)
run('tar -xzf %s' % filename)
sudo('cp -r %s/* /opt/node' % folder)
sudo('ln -s /opt/node/bin/node /usr/local/bin/node')
sudo('ln -s /opt/node/bin/npm /usr/local/bin/npm')
su_delete(folder)
su_delete(filename)
result = run('node -v')
if '0.8.21' in result:
print(green('Node 0.8.21 successfully installed'))
else:
print(red('Something went wrong while installing Node 0.8.21'))
@task
def uninstall_node08():
'''
Uninstall node 0.8.18
'''
sudo('npm uninstall npm')
if not is_arm():
version = '0.8.18'
folder = 'node-v%s' % version
filename = folder + '.tar.gz'
else:
version = '0.8.21'
folder = 'node-v%s-linux-arm-pi' % version
filename = folder + '.tar.gz'
require_file(url='http://nodejs.org/dist/v%s/%s' % (version, filename))
sudo('tar -xzf %s' % filename)
with cd('%s' % folder):
sudo('./configure')
sudo('make uninstall')
sudo('make distclean')
su_delete('%s*' % folder)
print(green('Node 0.8.18 successfully uninstalled'))
@task
def install_couchdb():
'''
Install CouchDB 1.3.0
'''
packages = [
'erlang',
'libicu-dev',
'libcurl4-openssl-dev',
'curl'
]
if system.distrib_id() == 'Debian' \
and system.distrib_release().startswith('6'):
packages.append('libmozjs-dev')
else:
packages.append('libmozjs185-dev')
require.deb.packages(packages)
require_file(
url='http://apache.crihan.fr/dist/couchdb/source/' +
'1.3.0/apache-couchdb-1.3.0.tar.gz')
run('tar -xzvf apache-couchdb-1.3.0.tar.gz')
with cd('apache-couchdb-1.3.0'):
run('./configure; make')
result = sudo('make install')
installed = result.find('You have installed Apache CouchDB,' +
' time to relax.')
if installed == -1:
print_failed('couchdb')
su_delete('apache-couchdb-1.3.0')
su_delete('rm -rf apache-couchdb-1.3.0.tar.gz')
require.users.user('couchdb', home='/usr/local/var/lib/couchdb')
sudo('chown -R couchdb:couchdb /usr/local/etc/couchdb')
sudo('chown -R couchdb:couchdb /usr/local/var/lib/couchdb')
sudo('chown -R couchdb:couchdb /usr/local/var/log/couchdb')
sudo('chown -R couchdb:couchdb /usr/local/var/run/couchdb')
sudo('chmod 0770 /usr/local/etc/couchdb')
sudo('chmod 0770 /usr/local/var/lib/couchdb')
sudo('chmod 0770 /usr/local/var/log/couchdb')
sudo('chmod 0770 /usr/local/var/run/couchdb')
require.supervisor.process(
'couchdb', user='couchdb',
command='couchdb', autostart='true',
environment='HOME=/usr/local/var/lib/couchdb')
print(green('CouchDB 1.3.0 successfully installed'))
@task
def config_couchdb():
if files.exists('/etc/cozy/couchdb.login'):
# CouchDB has an old admin
with hide('running', 'stdout'):
# Recover old password
logins = sudo('cat /etc/cozy/couchdb.login')
logsCouchDB = logins.split('\r\n')
# Add new admin
couch_admin_path = '@127.0.0.1:5984/_config/admins/'
run('curl -X PUT http://%s:%s%s%s -d \'\"%s\"\'' %
(
logsCouchDB[0],
logsCouchDB[1],
couch_admin_path,
USERNAME,
PASSWORD,
))
# Delete old admin
run('curl -X DELETE ' +
'http://%s:%[email protected]:5984/_config/admins/%s' %
(USERNAME, PASSWORD, logsCouchDB[0]))
sudo('rm -rf /etc/cozy/couchdb.login')
else:
# CouchDB has not an admin
# Create admin
with hide('running', 'stdout'):
couch_admin_path = '127.0.0.1:5984/_config/admins/'
run('curl -X PUT http://%s%s -d \'\"%s\"\'' %
(couch_admin_path, USERNAME, PASSWORD))
sudo('mkdir -p /etc/cozy')
# Create file to keep admin's password
require.files.file(
path='/etc/cozy/couchdb.login',
contents=USERNAME + '\n' + PASSWORD,
use_sudo=True,
owner='cozy-data-system',
mode='700'
)
print(green('CouchDB 1.3.0 successfully configured'))
@task
def uninstall_couchdb():
'''
Install CouchDB 1.3.0
'''
require_file(
url='http://apache.crihan.fr/dist/couchdb/source/' +
'1.3.0/apache-couchdb-1.3.0.tar.gz')
run('tar -xzvf apache-couchdb-1.3.0.tar.gz')
with cd('apache-couchdb-1.3.0'):
sudo('./configure')
sudo('make uninstall')
sudo('make distclean')
su_delete('/usr/local/share/couchdb')
su_delete('/usr/local/lib/couchdb')
su_delete('/usr/local/var/lib/couchdb')
su_delete('/usr/local/var/log/couchdb')
su_delete('/usr/local/var/run/couchdb')
su_delete('/usr/local/share/doc/couchdb')
su_delete('/usr/local/bin/couchjs')
su_delete('/usr/local/bin/couchdb')
su_delete('apache-couchdb-1.3.0')
su_delete('apache-couchdb-1.3.0.tar.gz')
su_delete('/etc/supervisor/conf.d/couchdb.conf')
su_delete('/etc/cozy/couchdb.login')
supervisor.update_config()
print(green('CouchDB 1.3.0 successfully uninstalled'))
@task
def install_postfix():
'''
Install a postfix instance (required for mail sending).
'''
#domain = prompt('Enter your domain name:',
# default='myinstance.cozycloud.cc')
require.postfix.server('cozycloud.cc')
print(green('Postfix successfully installed'))
@task
def uninstall_postfix():
'''
Uninstall postfix.
'''
require.deb.uninstall('postfix')
print(green('Postfix successfully uninstalled'))
@task
def uninstall_cozy():
'''
Uninstall postfix.
'''
supervisor.stop_process('cozy-controller')
supervisor.stop_process('cozy-indexer')
su_delete('/usr/local/var/cozy-indexer')
su_delete('/usr/local/cozy-indexer')
su_delete('/usr/local/cozy')
su_delete('/home/cozy*')
su_delete('/etc/cozy')
su_delete('/etc/nginx/conf.d/cozy.conf')
su_delete('/etc/supervisor/conf.d/cozy-controller.conf')
su_delete('/etc/supervisor/conf.d/cozy-indexer.conf')
supervisor.update_config()
print(green('Cozy successfully uninstalled'))
@task
def create_cozy_user():
'''
Add Cozy user with no home directory.
'''
require.user('cozy', home=False, create_home=False)
require.user('cozy-data-system', create_home=True)
require.user('cozy-home', create_home=True)
print(green('Cozy users successfully added'))
@task
def install_monitor():
'''
Install Coffeescript, Compound and Cozy Monitor.
'''
if is_arm():
sudo('npm install coffee-script -g')
sudo('ln -s /usr/local/bin/coffee /opt/node/bin/coffee')
else:
require.nodejs.package('coffee-script')
require.nodejs.package('cozy-monitor')
require.nodejs.package('brunch', version='1.6.3')
print(green('Monitor, compound, brunch and coffee script ' +
'successfully installed'))
@task
def install_controller():
'''
Install Cozy Controller Application Manager. Daemonize with supervisor.
'''
require.nodejs.package('cozy-controller')
sudo('mkdir -p /etc/cozy')
sudo('mkdir -p /etc/cozy/pids')
require.files.file(
path='/etc/cozy/controller.token',
mode='700',
contents=TOKEN,
use_sudo=True,
owner='cozy-home'
)
path = '/usr/local/lib/node_modules/cozy-controller/bin/cozy-controller'
require.supervisor.process(
'cozy-controller',
command="%s -u --auth --per 755" % path,
environment='NODE_ENV="production"',
user='root'
)
supervisor.stop_process('cozy-controller')
## In case where two cozy-controllers are started
with settings(warn_only=True):
sudo('pkill -9 node')
supervisor.start_process('cozy-controller')
if is_arm():
time.sleep(20)
else:
time.sleep(10)
with hide('running', 'stdout'):
result = run('curl -X GET http://127.0.0.1:9002/')
if result != '{"error":"Wrong auth token"}':
print_failed('cozy-controller')
print(green('Cozy Controller successfully started'))
@task
def install_controller_dev():
'''
Install Cozy Controller Application Manager. Daemonize with supervisor.
'''
require.nodejs.package('cozy-controller')
require.supervisor.process(
'cozy-controller',
command='cozy-controller -c -u --per 755',
environment='NODE_ENV="development"',
user='root'
)
supervisor.restart_process('cozy-controller')
import time
time.sleep(5)
with hide('running', 'stdout'):
result = run('curl -X GET http://127.0.0.1:9002/')
if result != '{"message":"No drones specified"}':
print_failed("cozy-controller")
print(green('Cozy Controller successfully started'))
@task
def install_indexer():
'''
Install Cozy Data Indexer. Use supervisord to daemonize it.
'''
home = '/usr/local/cozy-indexer'
indexer_dir = '%s/cozy-data-indexer' % home
indexer_env_dir = '%s/virtualenv' % indexer_dir
python_exe = indexer_dir + '/virtualenv/bin/python'
indexer_exe = 'server.py'
process_name = 'cozy-indexer'
require.files.directory(home, use_sudo=True)
with cd(home):
if files.exists('cozy-data-indexer'):
su_delete('cozy-data-indexer')
sudo('git clone https://github.com/mycozycloud/cozy-data-indexer.git')
require.python.virtualenv(indexer_env_dir, use_sudo=True)
with python.virtualenv(indexer_env_dir):
sudo(
'pip install --use-mirrors -r %s/requirements/common.txt' %
indexer_dir)
sudo('chown -R cozy:cozy %s' % home)
require.supervisor.process(
process_name,
command='%s %s' % (python_exe, indexer_exe),
directory=indexer_dir,
user='cozy'
)
supervisor.restart_process(process_name)
if is_arm():
time.sleep(10)
else:
time.sleep(1)
result = run('curl -X GET http://127.0.0.1:9102/')
is_installed = result.find("Cozy Data Indexer")
if is_installed == -1:
print_failed("cozy-data-indexer")
print(green("Data Indexer successfully started"))
@task
def install_data_system():
'''
Install Cozy Data System. Daemonize with Haibu.
'''
result = sudo('cozy-monitor install data-system')
installedApp = result.find('successfully installed')
if installedApp == -1:
print_failed('data-system')
else:
print(green('Data-system successfully installed'))
@task
def install_home():
'''
Install Cozy Home
'''
result = sudo('cozy-monitor install home')
installedApp = result.find('successfully installed')
if installedApp == -1:
print_failed('home')
else:
print(green('Home successfully installed'))
@task
def install_proxy():
'''
Install Cozy Proxy
'''
result = sudo('cozy-monitor install proxy')
installedApp = result.find('successfully installed')
if installedApp == -1:
print_failed('proxy')
else:
print(green('Proxy successfully installed'))
@task
def init_domain():
'''
Register domain name inside Cozy Home.
'''
domain = prompt('What is your domain name (ex: cozycloud.cc)?')
with cd('ls /usr/local/cozy/apps/home/home/cozy-home/'):
cozydo('coffee commands setdomain %s' % domain)
print(green('Domain set to: %s' % domain))
@task
def create_cert():
'''
Create SSL certificates.
'''
etc_dir = '/etc/cozy'
require.files.directory(etc_dir, use_sudo=True, owner='cozy')
with cd(etc_dir):
sudo('openssl genrsa -out ./server.key 1024')
sudo(
'openssl req -new -x509 -days 3650 -key ' +
'./server.key -out ./server.crt -batch')
sudo('chmod 640 server.key')
require.group('ssl-cert')
sudo('chown cozy:ssl-cert ./server.key')
print(green('Certificates successfully created.'))
def reset_cert():
'''
Reset SSL certificates
'''
delete_if_exists('/etc/cozy/server.crt')
delete_if_exists('/etc/cozy/server.key')
print(green('Previous certificates successfully deleted.'))
create_cert()
PROXIED_SITE_TEMPLATE = '''
server {
listen %(port)s;
server_name %(server_name)s;
ssl_certificate /etc/cozy/server.crt;
ssl_certificate_key /etc/cozy/server.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_protocols SSLv3 TLSv1;
ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
ssl_prefer_server_ciphers on;
ssl on;
gzip_vary on;
client_max_body_size 1024M;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect http:// https://;
proxy_pass %(proxy_url)s;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
access_log /var/log/nginx/%(server_name)s.log;
}
'''
@task
def install_nginx():
'''
Install NGINX and make it use certs.
'''
if system.distrib_id() == 'Debian':
require_file(url='http://nginx.org/packages/keys/nginx_signing.key')
deb.add_apt_key('nginx_signing.key')
su_delete('nginx_signing.key')
url = 'http://nginx.org/packages/debian/'
distrib = 'squeeze'
if system.distrib_release().startswith('7'):
distrib = 'wheezy'
require.deb.source('nginx', url, distrib, 'nginx')
require.deb.package('nginx')
contents = PROXIED_SITE_TEMPLATE % {
'server_name': 'cozy',
'port': 443,
'proxy_url': 'http://127.0.0.1:9104'
}
require.files.file(
'/etc/nginx/conf.d/cozy.conf',
contents=contents,
use_sudo=True)
else:
require.deb.ppa('ppa:nginx/stable')
require.nginx.site(
'cozy',
template_contents=PROXIED_SITE_TEMPLATE,
enabled=True,
port=443,
proxy_url='http://127.0.0.1:9104'
)
if files.exists('/etc/nginx/conf.d/default.conf'):
su_delete('/etc/nginx/conf.d/default.conf')
if files.exists('/etc/nginx/conf.d/example_ssl.conf'):
su_delete('/etc/nginx/conf.d/example_ssl.conf')
service.restart('nginx')
print(green('Nginx successfully installed.'))
@task
def restart_cozy():
sudo('cozy-monitor restart data-system')
sudo('cozy-monitor restart home')
sudo('cozy-monitor restart proxy')
print(green('Stack restarted successfully.'))
## No setup tasks
@task
def update_stack():
'''
Update applications
'''
supervisor.stop_process('cozy-controller')
nodejs.update_package('cozy-controller')
supervisor.start_process('cozy-controller')
nodejs.update_package('cozy-monitor')
sudo('cozy-monitor update data-system')
sudo('cozy-monitor update home')
sudo('cozy-monitor update proxy')
update_indexer()
print(green('Stack updated successfully.'))
@task
def update_all_apps():
sudo('cozy-monitor update-all')
print(green('All apps successfully updated.'))
@task
def update_indexer():
'''
Update Cozy indexer module.
'''
home = '/usr/local/cozy-indexer'
indexer_dir = '%s/cozy-data-indexer' % home
indexer_env_dir = '%s/virtualenv' % indexer_dir
with cd(indexer_dir):
sudo('git pull origin master')
with python.virtualenv(indexer_env_dir):
sudo(
'pip install --use-mirrors --upgrade -r %s/requirements/common.txt' %
indexer_dir)
supervisor.restart_process('cozy-indexer')
@task
def reset_account():
'''
Delete current user account
'''
with cd('ls /usr/local/cozy/apps/home/home/cozy-home/'):
sudo('coffee commands cleanuser')
print(green('Current account deleted.'))
@task
def reset_controller_token():
'''
Reset controller token
'''
file_path = '/etc/cozy/controller.token'
delete_if_exists(file_path)
print(green('Controller token successfully deleted.'))
require.files.file(
path=file_path,
mode='700',
contents=TOKEN,
use_sudo=True,
owner='cozy-home'
)
print(green('Controller token successfully generated.'))
@task
def reset_security_tokens():
'''
Reset all the security tokens for the Cozy (SSL certificates,
Controller token, CouchDB superuser)
'''
reset_cert()
reset_controller_token()
config_couchdb()
print(green('All the tokens have been reset.'))
"""Help tasks"""
@task
def help(name=None):
"""Display help for a given task
Options:
name - The task to display help on.
To display a list of available tasks type:
$ fab -l
To display help on a specific task type:
$ fab help:<name>
"""
if name is None:
name = "help"
task = crawl(name, state.commands)
if isinstance(task, Task):
doc = getattr(task, "__doc__", None)
if doc is not None:
print("Help on {0:s}:".format(name))
print(doc)
else:
print("No help available for {0:s}".format(name))
else:
print("No such task {0:s}".format(name))
print("For a list of tasks type: fab -l")