create_from_dump hinzugefügt
parent
5c6c645b13
commit
b362e4a61e
|
|
@ -86,6 +86,11 @@ def main():
|
|||
'set_admin_rights',
|
||||
]
|
||||
|
||||
if cmd == 'create_dump':
|
||||
methods = [
|
||||
'create_dump',
|
||||
]
|
||||
|
||||
if cmd == 'create_from_dump':
|
||||
methods = [
|
||||
'create_db_from_dump',
|
||||
|
|
@ -219,7 +224,7 @@ def main():
|
|||
|
||||
env.pwd = raw_input('Passwort: ')
|
||||
|
||||
if cmd == 'create':
|
||||
if cmd in ['create','create_dump','create_from_dump']:
|
||||
env.super_admin_pw = raw_input('Super-Admin-Passwort: ')
|
||||
|
||||
print
|
||||
|
|
|
|||
|
|
@ -34,6 +34,25 @@ class CamadeusFunctions():
|
|||
print 'Error occured: %s' % msg
|
||||
return False
|
||||
|
||||
def create_dump(self):
|
||||
""" Erstelle Odoo-Dump"""
|
||||
base_url = '%s:%s/web/database/backup' % (self.env.host, self.env.port)
|
||||
params = {
|
||||
'backup_db': self.env.dbname,
|
||||
'backup_format': 'zip',
|
||||
'backup_pwd': self.env.super_admin_pw,
|
||||
'token': 'x',
|
||||
}
|
||||
|
||||
res = requests.post(base_url, params=params, verify=False, stream=True)
|
||||
|
||||
if res.headers['Content-Type'].startswith('application/octet-stream'):
|
||||
with open(self.config.dump_file, 'wb') as fh:
|
||||
chunk_size = 100000
|
||||
for chunk in res.iter_content(chunk_size):
|
||||
fh.write(chunk)
|
||||
return True
|
||||
|
||||
def create_db_from_dump(self):
|
||||
""" Neue Datenbank von Dump erstellen"""
|
||||
|
||||
|
|
@ -42,13 +61,15 @@ class CamadeusFunctions():
|
|||
'db_file': ('db_file', fh.read(), 'application/octet-stream'),
|
||||
}
|
||||
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.super_admin_pw, self.env.dbname)
|
||||
print 'Request: ' + url
|
||||
res = requests.post(url, files=files, verify=False)
|
||||
if (res.status_code != 200):
|
||||
return False
|
||||
print "\nACHTUNG: Nicht vergessen './cam [env] anonym' auszuführen, sodass es zu keiner Kommunikation mit dem Produktivsystem kommt"
|
||||
return True
|
||||
|
||||
|
||||
def login(self):
|
||||
"""Login"""
|
||||
|
||||
|
|
@ -765,10 +786,10 @@ class CamadeusFunctions():
|
|||
"""Anonymisieren der Daten"""
|
||||
|
||||
res = True
|
||||
res &= self.make_anonymous_one('make_anonymous_partner')
|
||||
res &= self.make_anonymous_one('make_anonymous_project')
|
||||
res &= self.make_anonymous_one('make_anonymous_employee')
|
||||
res &= self.make_anonymous_one('make_anonymous_leads')
|
||||
#res &= self.make_anonymous_one('make_anonymous_partner')
|
||||
#res &= self.make_anonymous_one('make_anonymous_project')
|
||||
#res &= self.make_anonymous_one('make_anonymous_employee')
|
||||
#res &= self.make_anonymous_one('make_anonymous_leads')
|
||||
res &= self.make_anonymous_one('make_anonymous_mailserver')
|
||||
res &= self.make_anonymous_one('make_anonymous_cron')
|
||||
return res
|
||||
|
|
|
|||
Loading…
Reference in New Issue