forked from YunoHost/moulinette
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action_map.yml
907 lines (820 loc) · 27.7 KB
/
action_map.yml
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
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
##########################################################################
# Category/actions/arguments file
#
#
# Except for general_arguments, this file contains 3 levels
# as in this sample command line:
#
# yunohost monitor info --cpu --ram
# ^ ^ ^ ^
# (script) | category | action | parameters
#
#
# Above example will lead to the function 'monitor_info(args)'
# in the file 'yunohost_monitor.py' with 'cpu' and 'ram'
# stored in an 'args' dictionnary.
#
# Usage:
# You can add a category at the first level, action at the second one,
# and arguments at the third one.
# If a connexion is needed for the action, don't forget to add it to
# the action parameters (ldap, repo, dns or firewall).
#
# Documentation:
# You can see all arguments settings at the argparse documentation:
# http://docs.python.org/dev/library/argparse.html
# #argparse.ArgumentParser.add_argument
#
# Don't forget to turn argument yaml style (setting: value)
#
##########################################################################
# TODO: Add patern for all this
#############################
# General args #
#############################
general_arguments:
-v:
full: --version
help: Display moulinette version
action: version
version: moulinette %version%
#############################
# User #
#############################
user:
category_help: Manage users
actions:
### user_list()
list:
action_help: List users
api: GET /users
arguments:
--fields:
help: fields to fetch
nargs: "+"
-f:
full: --filter
help: LDAP filter used to search
-l:
full: --limit
help: Maximum number of user fetched
-o:
full: --offset
help: Starting number for user fetching
### user_create()
create:
action_help: Create user
api: POST /users
arguments:
-u:
full: --username
help: Must be unique
ask: "Username"
pattern: '^[a-z0-9_]+$'
-f:
full: --firstname
ask: "Firstname"
-l:
full: --lastname
ask: "Lastname"
-m:
full: --mail
help: Main mail address must be unique
ask: "Mail address"
pattern: '^[\w.-]+@[\w.-]+\.[a-zA-Z]{2,6}$'
-p:
full: --password
ask: "User password"
password: yes
### user_delete()
delete:
action_help: Delete user
api: 'DELETE /users/{users}'
arguments:
-u:
full: --users
help: Username of users to delete
ask: "Users to delete"
pattern: '^[a-z0-9_]+$'
nargs: "*"
--purge:
action: store_true
### user_update()
update:
action_help: Update user informations
api: 'PUT /users/{username}'
arguments:
username:
help: Username of user to update
-f:
full: --firstname
-l:
full: --lastname
-m:
full: --mail
-p:
full: --change-password
help: New password to set
metavar: PASSWORD
--add-mailforward:
help: Mailforward addresses to add
nargs: "*"
metavar: MAIL
--remove-mailforward:
help: Mailforward addresses to remove
nargs: "*"
metavar: MAIL
--add-mailalias:
help: Mail aliases to add
nargs: "*"
metavar: MAIL
--remove-mailalias:
help: Mail aliases to remove
nargs: "*"
metavar: MAIL
### user_info()
info:
action_help: Get user informations
api: 'GET /users/{username}'
arguments:
username:
help: Username or mail to get informations
#############################
# Domain #
#############################
domain:
category_help: Manage domains
actions:
### domain_list()
list:
action_help: List domains
api: GET /domains
arguments:
-f:
full: --filter
help: LDAP filter used to search
-l:
full: --limit
help: Maximum number of domain fetched
-o:
full: --offset
help: Starting number for domain fetching
### domain_add()
add:
action_help: Create a custom domain
api: POST /domains
arguments:
domains:
help: Domain name to add
nargs: '+'
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
-m:
full: --main
help: Is the main domain
action: store_true
-d:
full: --dyndns
help: Subscribe to the DynDNS service
action: store_true
### domain_remove()
remove:
action_help: Delete domains
api: 'DELETE /domains/{domains}'
arguments:
domains:
help: Domain(s) to delete
nargs: "+"
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
### domain_info()
info:
action_help: Get domain informations
api: 'GET /domains/{domain}'
arguments:
domain:
help: ""
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
#############################
# App #
#############################
app:
category_help: Manage apps
actions:
### app_fetchlist()
fetchlist:
action_help: Fetch application list from app server
api: PUT /app/lists
arguments:
-u:
full: --url
help: URL of remote JSON list (default http://fapp.yunohost.org/app/list/raw)
-n:
full: --name
help: Name of the list (default fapp)
### app_listlists()
listlists:
action_help: List fetched lists
api: GET /app/lists
### app_removelist()
removelist:
action_help: Remove list from the repositories
api: DELETE /app/lists
arguments:
-n:
full: --name
help: Name of the list to remove
ask: "List to remove"
pattern: '^[a-z0-9_]+$'
### app_list()
list:
action_help: List apps
api: GET /apps
arguments:
-l:
full: --limit
help: Maximum number of app fetched
-o:
full: --offset
help: Starting number for app fetching
-f:
full: --filter
help: Name filter of app_id or app_name
-r:
full: --raw
help: Return the full app_dict
action: store_true
### app_info()
info:
action_help: Get app info
api: GET /app/{app}
arguments:
app:
help: Specific app ID
-r:
full: --raw
help: Return the full app_dict
action: store_true
### app_map()
map:
action_help: List apps by domain
api: GET /app/map
arguments:
-a:
full: --app
help: Specific app to map
-r:
full: --raw
help: Return complete dict
action: store_true
-u:
full: --user
help: Allowed app map for a user
pattern: '^[a-z0-9_]+$'
### app_install() TODO: Write help
install:
action_help: Install apps
api: POST /app
arguments:
app:
help: App to install
-l:
full: --label
help: Custom name for the app
-a:
full: --args
help: Serialize arguments for app installation
### app_remove() TODO: Write help
remove:
action_help: Remove app
api: DELETE /app/{app}
arguments:
app:
help: App(s) to delete
### app_upgrade()
upgrade:
action_help: Upgrade app
api: PUT /app
arguments:
app:
help: App(s) to upgrade (default all)
nargs: "*"
-u:
full: --url
help: Git url to fetch for upgrade
-f:
full: --file
help: Folder or tarball for upgrade
### app_setting()
setting:
action_help: Set ou get an app setting value
api: GET /app/{app}/setting
arguments:
app:
help: App ID
key:
help: Key to get/set
-v:
full: --value
help: Value to set
-d:
full: --delete
help: Delete the key
action: store_true
### app_service()
service:
action_help: Add or remove a YunoHost monitored service
api: POST /app/service/{service}
arguments:
service:
help: Service to add/remove
-s:
full: --status
help: Custom status command
-l:
full: --log
help: Absolute path to log file to display
-r:
full: --runlevel
help: Runlevel priority of the service
-R:
full: --remove
help: Remove service
action: store_true
### app_checkport()
checkport:
action_help: Check availability of a local port
api: GET /app/checkport
arguments:
port:
help: Port to check
pattern: '^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$'
### app_checkurl()
checkurl:
action_help: Check availability of a web path
api: GET /app/checkurl
arguments:
url:
help: Url to check
-a:
full: --app
help: Write domain & path to app settings for further checks
### app_initdb()
initdb:
action_help: Create database and initialize it with optionnal attached script
api: POST /app/initdb
arguments:
user:
help: Name of the DB user
-p:
full: --password
help: Password of the DB (generated unless set)
-d:
full: --db
help: DB name (user unless set)
-s:
full: --sql
help: Initial SQL file
### app_ssowatconf()
ssowatconf:
action_help: Regenerate SSOwat configuration file
api: PUT /ssowatconf
### app_addaccess() TODO: Write help
addaccess:
action_help: Grant access right to users (everyone by default)
api: PUT /app/access
arguments:
apps:
nargs: "+"
-u:
full: --users
nargs: "+"
### app_removeaccess() TODO: Write help
removeaccess:
action_help: Revoke access right to users (everyone by default)
api: DELETE /app/access
arguments:
apps:
nargs: "+"
-u:
full: --users
nargs: "+"
#############################
# Backup #
#############################
backup:
category_help: Manage backups
actions:
### backup_init()
init:
action_help: Init Tahoe-LAFS configuration
api: POST /backup/init
arguments:
--helper:
help: Init as a helper node rather than a "helped" one
action: store_true
#############################
# Monitor #
#############################
monitor:
category_help: Monitor the server
actions:
### monitor_disk()
disk:
action_help: Monitor disk space and usage
api: GET /monitor/disk
arguments:
-f:
full: --filesystem
help: Show filesystem disk space
action: append_const
const: filesystem
dest: units
-t:
full: --io
help: Show I/O throughput
action: append_const
const: io
dest: units
-m:
full: --mountpoint
help: Monitor only the device mounted on MOUNTPOINT
action: store
-H:
full: --human-readable
help: Print sizes in human readable format
action: store_true
### monitor_network()
network:
action_help: Monitor network interfaces
api: GET /monitor/network
arguments:
-u:
full: --usage
help: Show interfaces bit rates
action: append_const
const: usage
dest: units
-i:
full: --infos
help: Show network informations
action: append_const
const: infos
dest: units
-H:
full: --human-readable
help: Print sizes in human readable format
action: store_true
### monitor_system()
system:
action_help: Monitor system informations and usage
api: GET /monitor/system
arguments:
-m:
full: --memory
help: Show memory usage
action: append_const
const: memory
dest: units
-c:
full: --cpu
help: Show CPU usage and load
action: append_const
const: cpu
dest: units
-p:
full: --process
help: Show processes summary
action: append_const
const: process
dest: units
-u:
full: --uptime
help: Show the system uptime
action: append_const
const: uptime
dest: units
-i:
full: --infos
help: Show system informations
action: append_const
const: infos
dest: units
-H:
full: --human-readable
help: Print sizes in human readable format
action: store_true
### monitor_updatestats()
update-stats:
action_help: Update monitoring statistics
api: POST /monitor/update-stats
arguments:
period:
help: Time period to update
choices:
- day
- week
- month
### monitor_showstats()
show-stats:
action_help: Show monitoring statistics
api: GET /monitor/show-stats
arguments:
period:
help: Time period to show
choices:
- day
- week
- month
### monitor_enable()
enable:
action_help: Enable server monitoring
arguments:
-n:
full: --no-stats
help: Disable monitoring statistics
action: store_true
### monitor_disable()
disable:
action_help: Disable server monitoring
#############################
# Service #
#############################
service:
category_help: Manage services
actions:
### service_start()
start:
action_help: Start one or more services
arguments:
names:
help: Service name to start
nargs: +
metavar: NAME
### service_stop()
stop:
action_help: Stop one or more services
arguments:
names:
help: Service name to stop
nargs: +
metavar: NAME
### service_enable()
enable:
action_help: Enable one or more services
arguments:
names:
help: Service name to enable
nargs: +
metavar: NAME
### service_disable()
disable:
action_help: Disable one or more services
arguments:
names:
help: Service name to disable
nargs: +
metavar: NAME
### service_status()
status:
action_help: Show status information about one or more services (all by default)
arguments:
names:
help: Service name to show
nargs: "*"
metavar: NAME
### service_log()
log:
action_help: Log every log files of a service
arguments:
name:
help: Service name to log
-n:
full: --number
help: Number of lines to display
pattern: '^[0-9]+$'
default: "50"
#############################
# Firewall #
#############################
firewall:
category_help: Manage firewall rules
actions:
### firewall_list()
list:
action_help: List all firewall rules
api: GET /firewall/list
### firewall_reload()
reload:
action_help: Reload all firewall rules
api: PUT /firewall/list
arguments:
-u:
full: --upnp
help: upnp
action: store_true
### firewall_allow()
allow:
action_help: Allow connection port/protocol
api: POST /firewall/port
arguments:
port:
help: Port to open
pattern: '^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])((:[0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]){0,1})$'
protocol:
help: Protocol associated with port
choices:
- UDP
- TCP
- Both
-i:
full: --ipv6
help: ipv6
action: store_true
-u:
full: --upnp
help: upnp
action: store_true
### firewall_disallow()
disallow:
action_help: Disallow connection
api: DELETE /firewall/port
arguments:
port:
help: Port to open
protocol:
help: Protocol associated with port
choices:
- UDP
- TCP
- Both
-i:
full: --ipv6
help: ipv6
action: store_true
-u:
full: --upnp
help: upnp
action: store_true
### firewall_installupnp()
installupnp:
action_help: Add upnp cron
api: POST /firewall/upnp
### firewall_removeupnp()
removeupnp:
action_help: Remove upnp cron
api: DELETE /firewall/upnp
### firewall_stop()
stop:
action_help: Stop iptables and ip6tables
api: DELETE /firewall
### firewall_checkupnp()
checkupnp:
action_help: check if UPNP is install or not (0 yes 1 no)
api: GET /firewall/upnp
#############################
# DynDNS #
#############################
dyndns:
category_help: Subscribe and Update DynDNS Hosts
actions:
### dyndns_subscribe()
subscribe:
action_help: Subscribe to a DynDNS service
api: POST /dyndns
arguments:
--subscribe-host:
help: Dynette HTTP API to subscribe to
default: "dyndns.yunohost.org"
-d:
full: --domain
help: Full domain to subscribe with
-k:
full: --key
help: Public DNS key
### dyndns_update()
update:
action_help: Update IP on DynDNS platform
api: PUT /dyndns
arguments:
--dyn-host:
help: Dynette DNS server to inform
default: "dynhost.yunohost.org"
-d:
full: --domain
help: Full domain to subscribe with
-k:
full: --key
help: Public DNS key
-i:
full: --ip
help: IP address to send
### dyndns_installcron()
installcron:
action_help: Install IP update cron
api: POST /dyndns/cron
### dyndns_removecron()
removecron:
action_help: Remove IP update cron
api: DELETE /dyndns/cron
#############################
# Tools #
#############################
tools:
category_help: Specific tools
actions:
### tools_ldapinit()
ldapinit:
action_help: YunoHost LDAP initialization
api: POST /ldap
### tools_adminpw()
adminpw:
action_help: Change admin password
api: PUT /adminpw
arguments:
-o:
full: --old-password
ask: "Current admin password"
password: yes
-n:
full: --new-password
ask: "New admin password"
password: yes
### tools_maindomain()
maindomain:
action_help: Main domain change tool
api: PUT /domain/main
arguments:
-o:
full: --old-domain
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
-n:
full: --new-domain
ask: "New main domain"
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
### tools_postinstall()
postinstall:
action_help: YunoHost post-install
api: POST /postinstall
arguments:
-d:
full: --domain
help: YunoHost main domain
ask: "Main domain"
pattern: '^([a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)(\.[a-zA-Z0-9]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)*(\.[a-zA-Z]{1}([a-zA-Z0-9\-]*[a-zA-Z0-9])*)$'
-p:
full: --password
help: YunoHost admin password
ask: "New admin password"
password: yes
--dyndns:
help: Subscribe domain to a DynDNS service
action: store_true
#############################
# Hook #
#############################
hook:
category_help: Manage hooks
actions:
### hook_add()
add:
action_help: Store hook script to filesystem
api: PUT /hook
arguments:
app:
help: App to link with
file:
help: Script to add
### hook_remove()
remove:
action_help: Remove hook scripts from filesystem
api: DELETE /hook
arguments:
app:
help: Scripts related to app will be removed
### hook_callback()
callback:
action_help: Execute all scripts binded to an action
api: GET /hooks
arguments:
action:
help: Action name
-a:
full: --args
help: Ordered list of arguments to pass to the script
nargs: '*'
### hook_check()
check:
action_help: Parse the script file and get arguments
api: GET /hook/check
arguments:
file:
help: File to check
### hook_exec()
exec:
action_help: Execute hook from a file with arguments
api: GET /hook
arguments:
file:
help: Script to execute
-a:
full: --args
help: Arguments to pass to the script