Forum Discussion
Sparks_86637
Aug 01, 2014Nimbostratus
Hi,
Guessing you've got this working by now, but for anyone else who's interested I got Marc's script to work by simply decoding the file_data as base64. Updated version below is exactly the same except for a few lines....
instantiate connection to bigip
obj = bigsuds.BIGIP(hostname=bigip_ip, username=bigip_user, password=bigip_pwd)
first save config file on bigip device
obj.System.ConfigSync.save_configuration(filename,'SAVE_FULL')
open target file for writing
f = open('/home/bigip_backups/' + filename + '.ucs','wb') <---- This line
download data to file
while write_continue == 1:
temp_config = obj.System.ConfigSync.download_configuration(filename + '.ucs',chunk_size,file_offset)
file_info = temp_config['return']
f.write(base64.b64decode(file_info['file_data'])) <---- And this line
detect EOF
if file_info['chain_type'] == 'FILE_LAST' or file_info['chain_type'] == 'FILE_FIRST_AND_LAST':
write_continue = 0
set offset
file_offset = file_offset + chunk_size
track download progress
print str(file_offset) + " bytes written"
DEBUG
print file_info['chain_type']
cleanup
f.close()
Thanks Marc; your work saved me a lot of time!
Cheers, Stephen