xmlrpc to schedule backup ?

mwellbro
Xpert

Hi all,

just played around a bit with the xmlrpc-scripting and tried to "upload" a backup-schedule onto a cluster ( V.6.2.8 ) - here is how it does not work:

import xmlrpclib
import ssl
def run(ctx):
    sslcontext = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
    sslcontext.verify_mode = ssl.CERT_NONE
    sslcontext.check_hostname = False
    s = xmlrpclib.ServerProxy("https://user..pwd..addr/cluster1/db_name",context=sslcontext)
    my_str = s.setBackupSchedule({'comment': 'added via xmlrpc',
               'month': '*', 
               'archive': 'v0002',
               'expire': '', 
               'day': '*', 
               'minute': '0', 
               'hour': '16', 
               'id': 8, 
               'level': 2, 
               'enabled': True, 
               'weekday': '*'})

Keeps giving me 

[22002] VM error: Fault: <Fault -1: 'ValueError: need more than 7 values to unpack'> (Session: 1682285919927523266)

so I guess my backup definition is wrong ( there are already 7 schedules active, hence the id:8 ) - too bad there´s no example over at https://github.com/exasol/exaoperation-xmlrpc ... anyone using this and/or could tell me how to get this to work ?
Python is certainly not my forte so it might be something blatantly obvious like confusing a dict with a list or something...

Looking forward to any takers 😉

Cheers,
Malte 

1 ACCEPTED SOLUTION

Charlie
Xpert

Hi Malte,

 

the documentation to to xml rpc api is in certain areas nonexistent.

 

You can only replace the whole schedule for a database and not just add an entry, so you have to specify an array of full schedule.

 

A dictionary for each entry would be nice but is not supported 

    db.setBackupSchedule([
        #Active/Inactive, minute, hour, day, month, weekday, volume, level, Expire in seconds, Comment
        [False,  '1', '3', '*', '*','*', 'v0002','0', 3600*24, 'Test XMLRPC']
    ]
    )

 

This should create a backup with level 0 that is not active and runs every day at 03:01 and expires after 24 hours. This will also replace the existing schedule entries.

View solution in original post

2 REPLIES 2

Charlie
Xpert

Hi Malte,

 

the documentation to to xml rpc api is in certain areas nonexistent.

 

You can only replace the whole schedule for a database and not just add an entry, so you have to specify an array of full schedule.

 

A dictionary for each entry would be nice but is not supported 

    db.setBackupSchedule([
        #Active/Inactive, minute, hour, day, month, weekday, volume, level, Expire in seconds, Comment
        [False,  '1', '3', '*', '*','*', 'v0002','0', 3600*24, 'Test XMLRPC']
    ]
    )

 

This should create a backup with level 0 that is not active and runs every day at 03:01 and expires after 24 hours. This will also replace the existing schedule entries.

View solution in original post

mwellbro
Xpert

Thanks @Charlie ! Will test and mark as solution today 🙂 

Hey @exa-Chris , see: we do talk here 😉