mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
add try import ldap and psutils
This commit is contained in:
parent
1f4b115b6f
commit
2caab6a31d
5 changed files with 49 additions and 35 deletions
35
appconftest/bash/yunohost
Normal file → Executable file
35
appconftest/bash/yunohost
Normal file → Executable file
|
@ -1,33 +1,4 @@
|
||||||
# yuno-repo(1) completion
|
#!/bin/sh
|
||||||
|
|
||||||
_yunohost()
|
cd /usr/share/pyshared/yunohost/
|
||||||
{
|
python parse_args $@
|
||||||
local argc cur prev opts
|
|
||||||
COMPREPLY=()
|
|
||||||
|
|
||||||
argc=${COMP_CWORD}
|
|
||||||
cur="${COMP_WORDS[argc]}"
|
|
||||||
prev="${COMP_WORDS[argc-1]}"
|
|
||||||
opts=$(yunohost2 -h | grep usage | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
|
|
||||||
|
|
||||||
if [[ $argc = 1 ]];
|
|
||||||
then
|
|
||||||
COMPREPLY=( $(compgen -W "$opts --help" -- $cur ) )
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$prev" != "--help" ]];
|
|
||||||
then
|
|
||||||
if [[ $argc = 2 ]];
|
|
||||||
then
|
|
||||||
opts2=$(yunohost2 $prev -h | grep usage | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
|
|
||||||
COMPREPLY=( $(compgen -W "$opts2 --help" -- $cur ) )
|
|
||||||
elif [[ $argc = 3 ]];
|
|
||||||
then
|
|
||||||
COMPREPLY=( $(compgen -W "--help" $cur ) )
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
COMPREPLY=()
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
complete -F _yunohost yunohost
|
|
||||||
|
|
33
appconftest/bash/yunohost_cli
Normal file
33
appconftest/bash/yunohost_cli
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# yunohost(1) completion
|
||||||
|
|
||||||
|
_yunohost_cli()
|
||||||
|
{
|
||||||
|
local argc cur prev opts
|
||||||
|
COMPREPLY=()
|
||||||
|
|
||||||
|
argc=${COMP_CWORD}
|
||||||
|
cur="${COMP_WORDS[argc]}"
|
||||||
|
prev="${COMP_WORDS[argc-1]}"
|
||||||
|
opts=$(yunohost -h | grep usage | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
|
||||||
|
|
||||||
|
if [[ $argc = 1 ]];
|
||||||
|
then
|
||||||
|
COMPREPLY=( $(compgen -W "$opts --help" -- $cur ) )
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$prev" != "--help" ]];
|
||||||
|
then
|
||||||
|
if [[ $argc = 2 ]];
|
||||||
|
then
|
||||||
|
opts2=$(yunohost $prev -h | grep usage | awk -F"{" '{print $2}' | awk -F"}" '{print $1}' | tr ',' ' ')
|
||||||
|
COMPREPLY=( $(compgen -W "$opts2 --help" -- $cur ) )
|
||||||
|
elif [[ $argc = 3 ]];
|
||||||
|
then
|
||||||
|
COMPREPLY=( $(compgen -W "--help" $cur ) )
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
COMPREPLY=()
|
||||||
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
complete -F _yunohost_cli yunohost
|
|
@ -33,7 +33,7 @@ gettext.install('YunoHost')
|
||||||
try:
|
try:
|
||||||
from yunohost import YunoHostError, YunoHostLDAP, str_to_func, colorize, pretty_print_dict, display_error, connect_services, disconnect_services
|
from yunohost import YunoHostError, YunoHostLDAP, str_to_func, colorize, pretty_print_dict, display_error, connect_services, disconnect_services
|
||||||
except ImportError:
|
except ImportError:
|
||||||
sys.stderr.write('Require YunoHost lib')
|
sys.stderr.write('Error: Yunohost CLI Require YunoHost lib\n')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import ldap
|
try:
|
||||||
|
import ldap
|
||||||
|
except ImportError:
|
||||||
|
sys.stderr.write('Error: Yunohost CLI Require LDAP lib\n')
|
||||||
|
sys.stderr.write('apt-get install python-ldap\n')
|
||||||
|
sys.exit(1)
|
||||||
import ldap.modlist as modlist
|
import ldap.modlist as modlist
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import psutil
|
try:
|
||||||
|
import psutil
|
||||||
|
except ImportError:
|
||||||
|
sys.stderr.write('Error: Yunohost CLI Require psutil\n')
|
||||||
|
sys.stderr.write('apt-get install python-psutil\n')
|
||||||
|
sys.exit(1)
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
#from psutil._compat import print_
|
#from psutil._compat import print_
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue