/usr/scripts sans / final

This commit is contained in:
Daniel STAN 2015-07-23 17:26:50 +02:00
parent 650f55e7e8
commit ebeab8a0a0
8 changed files with 23 additions and 28 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
""" Envoie un mail avec la liste des serveurs qui ne sont pas synchro avec bcfg2. """ Envoie un mail avec la liste des serveurs qui ne sont pas synchro avec bcfg2.
@ -43,7 +43,6 @@ if __name__ == "__main__":
debug = "--debug" in sys.argv debug = "--debug" in sys.argv
if "--mail" in sys.argv: if "--mail" in sys.argv:
if hosts != "": if hosts != "":
sys.path.append("/usr/scripts/")
import utils.sendmail import utils.sendmail
utils.sendmail.sendmail("root@crans.org", "roots@crans.org", u"Serveurs non synchronisés avec bcfg2", hosts, more_headers={"X-Mailer" : "bcfg2-reports"}, debug=debug) utils.sendmail.sendmail("root@crans.org", "roots@crans.org", u"Serveurs non synchronisés avec bcfg2", hosts, more_headers={"X-Mailer" : "bcfg2-reports"}, debug=debug)
elif debug: elif debug:

View file

@ -1,11 +1,10 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import sys import sys
import netaddr import netaddr
if '/usr/scripts/' not in sys.path: if '/usr/scripts' not in sys.path:
sys.path.append('/usr/scripts/') sys.path.append('/usr/scripts')
import syslog import syslog
import subprocess import subprocess

View file

@ -1,4 +1,4 @@
#! /usr/bin/env python #!/bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# ############################################################# # #############################################################
# .. # ..
@ -38,7 +38,8 @@ import commands
import shutil import shutil
import syslog import syslog
import stat import stat
sys.path.append('/usr/scripts/') if '/usr/scripts' not in sys.path:
sys.path.append('/usr/scripts')
from cranslib.deprecated import module as deprecated_module from cranslib.deprecated import module as deprecated_module
deprecated_module() deprecated_module()
from cranslib.utils import QuoteForPOSIX as escapeForShell from cranslib.utils import QuoteForPOSIX as escapeForShell

View file

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# ############################################################# # #############################################################
# .. # ..
@ -31,10 +30,11 @@ Calcule le coût des options d'impression.
__version__ = '9.11' __version__ = '9.11'
import sys, os.path import sys, os.path
sys.path.append('/usr/scripts/gestion') from gestion.config import impression as config_impression
from config import impression as config_impression
from commands import getstatusoutput from commands import getstatusoutput
sys.path.append('/usr/scripts/')
if '/usr/scripts' not in sys.path:
sys.path.append('/usr/scripts')
from cranslib.utils import logs from cranslib.utils import logs
from subprocess import Popen, PIPE from subprocess import Popen, PIPE
from base import FichierInvalide, SoldeInsuffisant, PrintError, SettingsError from base import FichierInvalide, SoldeInsuffisant, PrintError, SettingsError
@ -415,9 +415,7 @@ class impression:
def _get_adh(self, adh): def _get_adh(self, adh):
if type(adh) == str: if type(adh) == str:
sys.path.append("/usr/scripts/gestion/") from gestion.ldap_crans import CransLdap
#from ldap_crans_test import crans_ldap
from ldap_crans import CransLdap
adh = CransLdap().getProprio(adh, 'w') adh = CransLdap().getProprio(adh, 'w')
return adh return adh

View file

@ -1,4 +1,3 @@
#!/usr/bin/env python
# -*- coding: utf-8 - # -*- coding: utf-8 -
# liste d'event http://www.voip-info.org/wiki/view/asterisk+manager+events # liste d'event http://www.voip-info.org/wiki/view/asterisk+manager+events
# liste d'action http://www.voip-info.org/wiki/view/Asterisk+manager+API # liste d'action http://www.voip-info.org/wiki/view/Asterisk+manager+API
@ -16,7 +15,8 @@ import threading
import psycopg2.extras import psycopg2.extras
from datetime import datetime from datetime import datetime
sys.path.append('/usr/scripts/') if '/usr/scripts' not in sys.path:
sys.path.append('/usr/scripts')
import lc_ldap.shortcuts import lc_ldap.shortcuts
import lc_ldap.objets import lc_ldap.objets

View file

@ -1,15 +1,11 @@
#!/usr/bin/env python #!/bin/bash /usr/scripts/python.sh
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys,os,hashlib import sys,os,hashlib
# The fuck is happening here ?
sys.path.append('/usr/scripts/gestion')
sys.path.append('/usr/scripts/')
import lc_ldap.shortcuts import lc_ldap.shortcuts
from asterisk_reload_conf import reload_config from asterisk_reload_conf import reload_config
conn=lc_ldap.shortcuts.lc_ldap_admin()
def gen_multidial(name, entensions): def gen_multidial(name, entensions):
dial=""" dial="""
@ -24,6 +20,7 @@ exten => %(name)s,n,Hangup()
return dial return dial
if __name__ == '__main__' : if __name__ == '__main__' :
conn=lc_ldap.shortcuts.lc_ldap_admin()
multidial="" multidial=""
for droit in ['nounou', 'bureau', 'cableur', 'imprimeur']: for droit in ['nounou', 'bureau', 'cableur', 'imprimeur']:
multidial+=gen_multidial(droit, (adh['aid'][0].value for adh in conn.search(u'(&(droits=%s)(!(chbre=EXT)))' % droit))) multidial+=gen_multidial(droit, (adh['aid'][0].value for adh in conn.search(u'(&(droits=%s)(!(chbre=EXT)))' % droit)))

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/bin/bash /usr/scripts/python.sh
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
# #
# Sclaimer # Sclaimer
@ -12,10 +12,11 @@ import sys
import smtplib import smtplib
import time import time
sys.path.append('/usr/scripts/gestion') if '/usr/scripts' not in sys.path:
from config import mac_prise sys.path.append('/usr/scripts')
from affich_tools import tableau
sys.path.append('/usr/scripts/') from gestion.config import mac_prise
from gestion.affich_tools import tableau
import lc_ldap.shortcuts import lc_ldap.shortcuts
import lc_ldap.objets import lc_ldap.objets
import collections import collections

View file

@ -1,7 +1,7 @@
import sys import sys
sys.path.append('/usr/scripts/') if '/usr/scripts' not in sys.path:
sys.path.append('/usr/scripts')
import tv.dns import tv.dns
sys.path.pop()
Dependencies = ["Time"] Dependencies = ["Time"]