Add opportunity to use machine's hostname instead it's ip address

Registered by slava valyavskiy

Now, nailgun agent configuration file(/etc/nailgun-agent/config.yaml) looks like: url: 'http://192.168.0.5:8000/api' . So, if you try to use hostname of machine instead it's ip address( something like 'http://fuel:8000/api') you will get following trace:

/opt/nailgun/bin/agent:114:in `initialize': undefined method `[]' for nil:NilClass (NoMethodError)
 from /opt/nailgun/bin/agent:521:in `new'
 from /opt/nailgun/bin/agent:521

It may be fixed something like that:
1. delete line - https://github.com/stackforge/fuel-web/blob/master/bin/agent#L117
2. add lines
hostname = @api_url.match(/http:\/\/([A-z].[A-z0-9.-]+)/)
@api_ip = hostname.nil? ? @api_url.match(/\bhttp:\/\/((\d{1,3}\.){3}\d{1,3})/)[1] : Resolv.getaddress(hostname[1]);

I guess, it will be convenient feature for new release.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
slava valyavskiy
Direction:
Needs approval
Assignee:
Fuel Python (Deprecated)
Definition:
New
Series goal:
Accepted for future
Implementation:
Not started
Milestone target:
milestone icon next

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.