Unnötigen Leerraum entfernen, einfache Anführungszeichen
parent
1260421e7f
commit
4c6521fb48
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
from lib import cli
|
from lib import cli
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
cli.main()
|
cli.main()
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,27 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import urlparse
|
|
||||||
import sys
|
import sys
|
||||||
|
import urlparse
|
||||||
|
|
||||||
from config_at import Config
|
from config_at import Config
|
||||||
from environments import ENVIRONMENTS, Environment
|
from environments import ENVIRONMENTS, Environment
|
||||||
from functions import CamadeusFunctions
|
from functions import CamadeusFunctions
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
def _usage():
|
def _usage():
|
||||||
print '\nVerwendung: cam.py <environment> <command> [<module_name>/<setup_function>]\n'
|
print '\nVerwendung: cam.py <environment> <command> [<module_name>/<setup_function>]\n'
|
||||||
print 'Commands:\n'
|
print 'Commands:\n'
|
||||||
print ' create Neue Datenbank erstellen'
|
print ' create Neue Datenbank erstellen'
|
||||||
print ' create_from_dump Neue Datenbank von Dump erstellen'
|
print ' create_from_dump Neue Datenbank von Dump erstellen'
|
||||||
print ' setup Modulinstallation. Konfigurationen.'
|
print ' setup Modulinstallation, Konfigurationen'
|
||||||
print ' setup_part setup_function Aufruf eines einzelnen Setup Schrittes.'
|
print ' setup_part setup_function Aufruf eines einzelnen Setup-Schrittes'
|
||||||
print ' "setup_part info" listet die verfügbaren Setup Schritte auf.'
|
print ' "setup_part info" listet die verfügbaren Setup-Schritte auf'
|
||||||
print ' rollout Setzt Dokumentnummern, importiert Benutzer, setzt cam_dmi auf noupdate, ...'
|
print ' rollout Setzt Dokumentnummern, importiert Benutzer, setzt cam_dmi auf noupdate, ...'
|
||||||
print ' update module_name Modul updaten'
|
print ' update module_name Modul updaten'
|
||||||
print ' install modul_name Modul installieren'
|
print ' install module_name Modul installieren'
|
||||||
print ' uninstall modul_name Modul deinstallieren'
|
print ' uninstall module_name Modul deinstallieren'
|
||||||
print ' cancel_upgrade modul_name Abbruch Modulinstallation'
|
print ' cancel_upgrade module_name Abbruch Modulinstallation'
|
||||||
print ' update_modules Update aller Module in der config Modulliste.'
|
print ' update_modules Update aller Module in der config-Modulliste'
|
||||||
print ' update_all Update aller verfügbaren Module'
|
print ' update_all Update aller verfügbaren Module'
|
||||||
print ' list-envs Environments auflisten'
|
print ' list-envs Environments auflisten'
|
||||||
print ' anonym Daten anonymisieren (Namen, Adresse, E-Mail, ...)'
|
print ' anonym Daten anonymisieren (Namen, Adresse, E-Mail, ...)'
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class Config():
|
class Config():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.dump_file = 'upgraded_file_name.dump'
|
||||||
self.dump_file = "upgraded_file_name.dump"
|
|
||||||
|
|
||||||
self.module_name = None
|
self.module_name = None
|
||||||
self.lang = 'de_DE' # de_DE, en_US
|
self.lang = 'de_DE' # de_DE, en_US
|
||||||
|
|
@ -243,7 +243,6 @@ class Config():
|
||||||
self.default_values = [ # ir.values
|
self.default_values = [ # ir.values
|
||||||
#('product.template', 'type', 'service'),
|
#('product.template', 'type', 'service'),
|
||||||
#('product.template', 'type', 'XML:xmlid'), #mit prefix "XML:" kann eine XML ID übergeben werden
|
#('product.template', 'type', 'XML:xmlid'), #mit prefix "XML:" kann eine XML ID übergeben werden
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
||||||
self.data_updates = {
|
self.data_updates = {
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class Environment():
|
class Environment():
|
||||||
def __init__(self, host, port, dbname, username, pwd=None, super_admin_pw=None, basic_auth=None):
|
def __init__(self, host, port, dbname, username, pwd=None, super_admin_pw=None, basic_auth=None):
|
||||||
self.host = host
|
self.host = host
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import pprint
|
import pprint
|
||||||
|
|
@ -42,7 +43,7 @@ class CamadeusFunctions():
|
||||||
}
|
}
|
||||||
url = '%s:%s/web/database/restore?restore_pwd=%s&new_db=%s&mode=restore'
|
url = '%s:%s/web/database/restore?restore_pwd=%s&new_db=%s&mode=restore'
|
||||||
url %= (self.env.host, self.env.port, self.env.admin_pw, self.env.dbname)
|
url %= (self.env.host, self.env.port, self.env.admin_pw, self.env.dbname)
|
||||||
print "Request: " + url
|
print 'Request: ' + url
|
||||||
res = requests.post(url, files=files, verify=False)
|
res = requests.post(url, files=files, verify=False)
|
||||||
if (res.status_code != 200):
|
if (res.status_code != 200):
|
||||||
return False
|
return False
|
||||||
|
|
@ -656,13 +657,12 @@ class CamadeusFunctions():
|
||||||
"""Defaultwerte für Dokumente setzen"""
|
"""Defaultwerte für Dokumente setzen"""
|
||||||
|
|
||||||
for model,field,value in self.config.default_values:
|
for model,field,value in self.config.default_values:
|
||||||
|
# Falls XML ID (prefix "XML:") dann die DB ID holen
|
||||||
#falls XML ID (prefix "XML:") dann die DB ID holen
|
|
||||||
if value[0:4] == 'XML:':
|
if value[0:4] == 'XML:':
|
||||||
xml_id = value[4:]
|
xml_id = value[4:]
|
||||||
dummy,dummy2,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id)
|
dummy,dummy2,res_id = self._execute('ir.model.data', 'xmlid_lookup', xml_id)
|
||||||
if not res_id:
|
if not res_id:
|
||||||
raise Exception("Defaultwerte Anlegen: XML ID %s nicht vorhanden!" % (xml_id))
|
raise Exception('Defaultwerte anlegen: XML ID %s nicht vorhanden!' % (xml_id))
|
||||||
value = res_id
|
value = res_id
|
||||||
|
|
||||||
vals = {
|
vals = {
|
||||||
|
|
@ -680,7 +680,6 @@ class CamadeusFunctions():
|
||||||
self._execute('ir.values', 'create', vals)
|
self._execute('ir.values', 'create', vals)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def update_special_values(self):
|
def update_special_values(self):
|
||||||
"""Spezialwerte setzen"""
|
"""Spezialwerte setzen"""
|
||||||
|
|
||||||
|
|
@ -705,7 +704,6 @@ class CamadeusFunctions():
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def update_values(self):
|
def update_values(self):
|
||||||
"""Existierende Daten aktualisieren"""
|
"""Existierende Daten aktualisieren"""
|
||||||
|
|
||||||
|
|
@ -742,7 +740,7 @@ class CamadeusFunctions():
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def invalidate_email(self):
|
def invalidate_email(self):
|
||||||
"""E-Mail adressen @ durch # erstezen um unbeabsichtigen E-Mail Versand zu vermeiden"""
|
"""In E-Mail-Adressen @ durch # ersetzen, um unbeabsichtigen E-Mail-Versand zu vermeiden"""
|
||||||
|
|
||||||
#E-Mail adressen von res_partner: @ -> #
|
#E-Mail adressen von res_partner: @ -> #
|
||||||
p_ids = self._execute('res.partner', 'search', [('email','ilike','%@%')])
|
p_ids = self._execute('res.partner', 'search', [('email','ilike','%@%')])
|
||||||
|
|
@ -754,7 +752,7 @@ class CamadeusFunctions():
|
||||||
self._execute('res.partner', 'write', [id], {'email': new_email})
|
self._execute('res.partner', 'write', [id], {'email': new_email})
|
||||||
|
|
||||||
def finance_config(self):
|
def finance_config(self):
|
||||||
"""Basiskonfiguration für Finanzen Laden"""
|
"""Basiskonfiguration für Finanzen laden"""
|
||||||
|
|
||||||
if hasattr(self.config, 'finance_config'):
|
if hasattr(self.config, 'finance_config'):
|
||||||
vals = self._execute('account.config.settings', 'default_get', [])
|
vals = self._execute('account.config.settings', 'default_get', [])
|
||||||
|
|
@ -775,15 +773,14 @@ class CamadeusFunctions():
|
||||||
res &= self.make_anonymous_one('make_anonymous_cron')
|
res &= self.make_anonymous_one('make_anonymous_cron')
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
def make_anonymous_one(self, func_name):
|
def make_anonymous_one(self, func_name):
|
||||||
"""Anonymisieren der Daten ein Schritt"""
|
"""Anonymisieren der Daten ein Schritt"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
getattr(self, func_name)()
|
getattr(self, func_name)()
|
||||||
print '.............. ' + func_name + ": OK"
|
print '.............. ' + func_name + ': OK'
|
||||||
except:
|
except:
|
||||||
print '.............. ' + func_name + ": ERROR!!!"
|
print '.............. ' + func_name + ': ERROR!!!'
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
@ -791,7 +788,7 @@ class CamadeusFunctions():
|
||||||
ids = self._execute('res.partner', 'search', [])
|
ids = self._execute('res.partner', 'search', [])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
'name': "Partner %s" % id,
|
'name': 'Partner %s' % id,
|
||||||
'street': '----',
|
'street': '----',
|
||||||
'email': 'test@example.com',
|
'email': 'test@example.com',
|
||||||
}
|
}
|
||||||
|
|
@ -802,7 +799,7 @@ class CamadeusFunctions():
|
||||||
ids = self._execute('project.project', 'search', [])
|
ids = self._execute('project.project', 'search', [])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
'name': "Projekt %s" % id,
|
'name': 'Projekt %s' % id,
|
||||||
}
|
}
|
||||||
self._execute('project.project', 'write', [id], vals)
|
self._execute('project.project', 'write', [id], vals)
|
||||||
|
|
||||||
|
|
@ -810,7 +807,7 @@ class CamadeusFunctions():
|
||||||
ids = self._execute('project.task', 'search', [])
|
ids = self._execute('project.task', 'search', [])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
'name': "Aufgabe %s" % id,
|
'name': 'Aufgabe %s' % id,
|
||||||
}
|
}
|
||||||
self._execute('project.task', 'write', [id], vals)
|
self._execute('project.task', 'write', [id], vals)
|
||||||
|
|
||||||
|
|
@ -819,7 +816,7 @@ class CamadeusFunctions():
|
||||||
ids = self._execute('hr.employee', 'search', [])
|
ids = self._execute('hr.employee', 'search', [])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
'name': "Mitarbeiter %s" % id,
|
'name': 'Mitarbeiter %s' % id,
|
||||||
'work_email': 'test@example.com',
|
'work_email': 'test@example.com',
|
||||||
}
|
}
|
||||||
self._execute('hr.employee','write', [id], vals)
|
self._execute('hr.employee','write', [id], vals)
|
||||||
|
|
@ -829,7 +826,7 @@ class CamadeusFunctions():
|
||||||
ids = self._execute('crm.lead', 'search', [])
|
ids = self._execute('crm.lead', 'search', [])
|
||||||
for id in ids:
|
for id in ids:
|
||||||
vals = {
|
vals = {
|
||||||
'name': "Lead %s" % id,
|
'name': 'Lead %s' % id,
|
||||||
'email_from': 'test@example.com',
|
'email_from': 'test@example.com',
|
||||||
'description': '',
|
'description': '',
|
||||||
}
|
}
|
||||||
|
|
@ -846,6 +843,3 @@ class CamadeusFunctions():
|
||||||
cron_ids = self._execute('ir.cron', 'search', [])
|
cron_ids = self._execute('ir.cron', 'search', [])
|
||||||
if cron_ids:
|
if cron_ids:
|
||||||
self._execute('ir.cron', 'write', cron_ids, {'active': False})
|
self._execute('ir.cron', 'write', cron_ids, {'active': False})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Reference in New Issue