Forum Discussion
How to test the checksum of an uploaded file
Hi, we use a webapp (incorporating the iControl jar) to upload configuration files to be used by our iRules. I would like to check the checksum of these files after upload and before enabling the configuration. However, my attempts to obtain the checksum result in an error.
The desired workflow is very simple:
Initialize session using Interfaces.initialize
Upload file using SystemConfigSyncBindingStub.upload_file
Read the checksum using LocalLBDataGroupFileBindingStub.get_checksum
Enable new configuration using LocalLBDataGroupFileBindingStub.set_local_path
The file upload succeeds, and set_local_path correctly applies the new configuration; however, the get_checksum call throws this exception:
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server
faultSubcode:
faultString: Exception caught in LocalLB::urn:iControl:LocalLB/DataGroupFile::get_checksum()
Exception: Common::OperationFailed
primary_error_code : 16908342 (0x01020036)
secondary_error_code : 0
error_string : 01020036:3: The requested unknown (/config/temp_GatewayLB.cfg) was not found.
faultActor:
faultNode:
faultDetail:
The file specification used in get_checksum is the same as is used in the set_local_path call
Should the checksum be accessible using this method and am I using the correct file specification?
If it is not possible to obtain a checksum for the uploaded file, is there a recommended means of validating the transfer? A previous version of the upload tool used to download the file after upload and compare, but this is very slow and not in my opinion a reliable verification method.
Thanks for any help or suggestions
Bill Hurn
3 Replies
- PeteWhite
Employee
I can't see any specific issues with this - if it were me I would check that the file was created in the /config directory and had the correct permissions etc. It could be the case that it takes a short amount of time between upload and checking ( because upload is normally to a temp directory and the file is then moved once it is complete ) so including a 1 second sleep might be a good idea as well. Have you tested the method using a known-present external datagroup file?
From the error it looks like the file didn't make it into the /config directory. Can you list the parameters you passed in for upload_file (ie. the file path) and the same for what you used with the get_checksum call? BTW, the get_checksum was designed for data group files so not sure if there is something in the internals that is limiting it from another format file. If you can provide paths for everything, I'll see if I can reproduce the issue...
- aelngccgcw938_2
Nimbostratus
I believe your second point is the significant one here; it appears that the get_checksum call is only applicable to Data Group files, so it can only be obtained after the upload file has been set as the 'active' instance, removing the possibility of a rollback. However, I think I can persuade people that re-running the upload in the case of transfer failure and using the previous week's details as a rollback is acceptable, I can checksum the newly install data group file.
To answer your question, the file is uploaded to /config/temp_GatewayLB.cfg; the same path is used in the get_checksum call but fails. A call to set_local_path using this path succeeds, suggesting that file transfer succeeded, and a subsequent call to get_checksum using the Data Group supplied to the set_local_path call also works, so it 'installs' correctly.
As mentioned, I have a reasonable alternative that checksums the data group so I will go with that; however, if you do find a method of obtaining a checksum of an arbitrary file, I would be interested to hear it.
Thank you for your response Bill Hurn
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
