Module: Rutema::Elements::Web
- Defined in:
- lib/rutema/elements/general.rb
Instance Method Summary collapse
-
#element_get_url(step) ⇒ Object
Performs an HTTP GET for the given URL.
Instance Method Details
#element_get_url(step) ⇒ Object
Performs an HTTP GET for the given URL.
It’s usually used as a quick “it’s alive” sign. It can also be used as a smart wait when restarting web servers.
Configuration
No configuration necessary
Extras
Requires the attribute address pointing to the URL to fetch
Optionally the following attributes can be defined: retry - sets the number of times to attempt to fetch the URL before failing pause - sets the duration of sleep between retry attemps (in seconds)
Example Elements
<get_url address=“localhost” retry=“5” pause=“3”/>
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rutema/elements/general.rb', line 31 def element_get_url step address=step.address if step.has_address? address||=@configuration.tools.get_url[:configuration][:address] if @configuration.tools.get_url && @configuration.tools.get_url[:configuration] raise Rutema::ParserError,"No address attribute and no configuration present for get_url step" unless address retries= step.retry.to_i if step.has_retry? retries||=0 pause_time = step.pause.to_i if step.has_retry? && step.has_pause? uri = URI.parse(step.address) step.cmd=url_command(uri,retries,pause_time) return step end |