Forum Discussion
Joe_Pawlicki_70
Nimbostratus
Dec 11, 2008perl ConfigSync = Epic Fail
I'm not getting this to work, so reluctantly will ask for help. There are many good threads with examples of saving the config after iControl changes, but after several hours of trying, I'm unable to get successful results. Granted, I'm green to iControl, and no coding whiz, but the examples seem straightforward.
What works: I'm able to add a member to a pool via my perl script, and can verify it's in memory via "b pool show".
What doesn't: ConfigSync::save_configuration - no config files are getting updated in /config.
My config:
$Sync = SOAP::Lite
-> uri('urn:iControl:ITCMSystem/ConfigSync')
-> readable(1)
-> proxy("https://$sHost:$sPort/iControl/iControlPortal.cgi");
$save_flag = "SAVE_HIGH_LEVEL_CONFIG";
$soap_response = $Sync->save_configuration
(
SOAP::Data->name(save_flag => $save_flag)
);
Another attempt...
$filename = "config/bigip.conf";
$soap_response = $Sync->save_configuration
(
SOAP::Data->name(filename => $filename),
SOAP::Data->name(save_flag => 0)
);
And just for the heck of it...(it doesn't seem to mind the flag)
$soap_response = $Sync->save_configuration
(
SOAP::Data->name(save_flag => 99)
);
7 Replies
- In the SDK, there is a ConfigSync.pl sample that illustrates how to use the ConfigSync methods with perl. I've just added it to the Wiki so you can get it from there as well.
http://devcentral.f5.com/wiki/default.aspx/iControl/PerlConfigSync.html
Click here
The save_configuration method takes two parameters. The first is the file name, the second is the save flag. In perl, you need to use the string based representation of the flag as you did in your first example but in that one you didn't pass in the filename.
And for your second example, you'll just pass in the actual config name without the "config/" directory part.
Check out the sample and if it's not clear, let me know and I'll try to highlight it some more.
-Joe - JRahm
Admin
Title of the Week for me! - Colin_Walker_12Historic F5 AccountYeah, I love it...
Colin - Joe_Pawlicki_70
Nimbostratus
Thanks, as always, for the valuable and timely help.
Is there any conflict between ""SAVE_FULL"/"SAVE_COMMON" and what the sdk lists as "SAVE_HIGH_LEVEL_CONFIG"/"SAVE_BASE_LEVEL_CONFIG"?
Still no joy:$thisfilename = "bigip.conf.joe"; $thissave_flag = "SAVE_COMMON"; $soap_response = $Sync->save_configuration ( SOAP::Data->name(filename => $thisfilename), SOAP::Data->name(save_flag => $thissave_flag) );
Looks like I'm going to have to go and actually learn more about this (curses!) - Totally my bad. This was a script I migrated from v4.x but didn't test the other deviations of the save_flag. I've updated the codeshare entry to work correctly.
Here's how the logic of this function works.
1. If save_flag is SAVE_FULL, the filename parameter is used and a full configuration archive is saved to /var/local/ucs/filename.ucs
2. If save_flag is SAVE_HIGH_LEVEL_CONFIG, the filename argument is ignored and the current high level config is saved to the /config/bigip.conf file.
3. If save_flag is SAVE_BASE_LEVEL_CONFIG, the filename argument is ignored and the current base level config is saved to the /config/bigip_base.conf file.
This is all highlighted on the SaveMode documentationhttp://devcentral.f5.com/wiki/default.aspx/iControl/System__ConfigSync__SaveMode.html
Click here
Sorry for the confusion and please post if you have any further questions and I'll do my best not to mess you up again B-).
-Joe - Joe_Pawlicki_70
Nimbostratus
Problem solved. Looks like I picked up some bad syntax from some of the older threads in this forum. In particular, the "urn:iControl:ITCMSystem/ConfigSync" here: https://devcentral.f5.com/Default.aspx?tabid=53&forumid=2&postid=3769&view=topic
That's the problem with trying to code over your head, but hey, that's how we learn, I guess. Taking the syntax directly from your PerlConfigSync page makes it work:$ConfigSync = SOAP::Lite -> uri('urn:iControl:System/ConfigSync') -> readable(1) -> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi"); eval { $ConfigSync->transport->http_request->header ( 'Authorization' => 'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '') ); };
I noted your updates to the save_flag, as well.
Muchas gracias. - Again, sorry for the confusion. The loosely typed languages are always the hardest because it's up to you to get everything right.
The ITCM* urn's are for the 4.x version of BIG-IP.
Glad you got things working now. Please feel free to post any and all questions that come up. I've done a bunch of stuff with the perl client code and I'd be glad to help.
-Joe
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects