F5 Sites
  • F5.com
  • F5 Labs
  • MyF5
  • NGINX
  • Partner Central
  • Education Services Portal (ESP)
Contact
  • Under Attack?
  • F5 Support
  • DevCentral Support
  • F5 Sales
  • NGINX Sales
  • F5 Professional Services
Skip to contentBrand Logo
Forums
CrowdSRC
Articles
GroupsEventsSuggestionsHow Do I...?
RegisterSign In
  1. DevCentral
  2. Articles
  3. Technical Articles

Getting Started With Ruby and iControl

Here on DevCentral we’ve released libraries for a number of the big languages from Java and Perl to Powershell. Up until now there has not been much love for Ruby. Well, that’s all about to ...
Published Jan 07, 2011
Version 1.0
101
application delivery
automation
basic
code
dev
devops
getting started
iControl
iRules
George_Watkins_'s avatar
George_Watkins_
Historic F5 Account
Joined September 17, 2008
View Profile
Sven_80544's avatar
Sven_80544
Icon for Nimbostratus rankNimbostratus
Jun 13, 2012
I had to patch the file lib/f5-icontrol.rb in order to make it work for me:

 

- It lacked the usage of the http_proxy I configured in my env, fixed by:

 

----------------------

 

@proxy = ENV['https_proxy'] in initialize()

 

----------------------

 

- The endpoint_url wasn't constructed the right way:

 

https://213.71.15.10//iControl/iControlPortal.cgi

 

makes the F5 do respond with a 302 (redirect) to the location "/tmui/login.jsp" which results in this error:

 

----------------------

 

/usr/lib/ruby/gems/1.8/gems/httpclient-2.2.5/lib/httpclient/util.rb:117:in `https?': undefined method `downcase' for nil:NilClass (NoMethodError)

 

from /usr/lib/ruby/gems/1.8/gems/httpclient-2.2.5/lib/httpclient/session.rb:738:in `connect'

 

----------------------

 

 

This diff addresses both problems:

 

----------------------

 

--- /tmp/f5/lib/f5-icontrol.rb 1970-01-01 01:00:00.000000000 +0100

 

+++ lib/f5-icontrol.rb 2012-06-13 12:20:11.369138428 +0200

 

@@ -14,6 +14,7 @@

 

@wsdls = wsdls

 

@endpoint = '/iControl/iControlPortal.cgi'

 

@interfaces = {}

 

+ @proxy = ENV['https_proxy']

 

end

 

 

def get_interfaces

 

@@ -25,10 +26,11 @@

 

@interfaces[wsdl] = SOAP::WSDLDriverFactory.new('file://' + wsdl_path).create_rpc_driver

 

@interfaces[wsdl].options['protocol.http.ssl_config.verify_mode'] = OpenSSL::SSL::VERIFY_NONE

 

@interfaces[wsdl].options['protocol.http.ssl_config.verify_callback'] = lambda{ |arg1, arg2| true }

 

+ @interfaces[wsdl].options['protocol.http.proxy'] = @proxy if !@proxy.nil?

 

 

 

- @interfaces[wsdl].options['protocol.http.basic_auth'] << ['https://' + @hostname + '/' + @endpoint, @username, @password]

 

- @interfaces[wsdl].endpoint_url = 'https://' + @hostname + '/' + @endpoint

 

+ @interfaces[wsdl].options['protocol.http.basic_auth'] << ['https://' + @hostname + @endpoint, @username, @password]

 

+ @interfaces[wsdl].endpoint_url = 'https://' + @hostname + @endpoint

 

end

 

end

 

----------------------

Help guide the future of your DevCentral Community!

What tools do you use to collaborate? (1min - anonymous)

ABOUT DEVCENTRAL

DevCentral NewsTechnical ForumTechnical ArticlesTechnical CrowdSRCCommunity GuidelinesDevCentral EULAGet a Developer Lab LicenseBecome a DevCentral MVP

RESOURCES

Product DocumentationWhite PapersGlossaryCustomer StoriesWebinarsFree Online CoursesTraining & Certification

SUPPORT

Manage SubscriptionsProfessional ServicesCreate a Service RequestSoftware DownloadsSupport Portal

PARTNERS

Find a Reseller PartnerTechnology AlliancesBecome an F5 PartnerLogin to Partner Central

©2026 F5, Inc. All rights reserved.
TrademarksPoliciesPrivacyCalifornia PrivacyDo Not Sell My Personal Information