Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom probing URL #909

Merged
merged 2 commits into from
Feb 19, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/offline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ Rally will automatically detect upon startup that no Internet connection is avai

[WARNING] No Internet connection detected. Automatic download of track data sets etc. is disabled.

It detects this by trying to connect to ``github.com``. If you want to disable this probing you can explicitly specify ``--offline``.
It detects this by trying to connect to ``https://github.com``. If you want it to probe against a different HTTP endpoint (e.g. a company-internal git server) you need to add a configuration property named ``probing.url`` in the ``system`` section of Rally's configuration file at ``~/.rally/rally.ini``. Specify ``--offline`` if you want to disable probing entirely.

Example of `system` section with custom probing url in ``~/.rally/rally.ini``::
bartier marked this conversation as resolved.
Show resolved Hide resolved

[system]
env.name = local
probing.url = "https://www.company-internal-server.com/"
bartier marked this conversation as resolved.
Show resolved Hide resolved


Using tracks
------------
Expand Down
3 changes: 2 additions & 1 deletion esrally/rally.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,8 @@ def main():
# Configure networking
net.init()
if not args.offline:
if not net.has_internet_connection():
probing_url = cfg.opts("system", "probing.url", default_value="https://github.com", mandatory=False)
if not net.has_internet_connection(probing_url):
console.warn("No Internet connection detected. Automatic download of track data sets etc. is disabled.",
logger=logger)
cfg.add(config.Scope.applicationOverride, "system", "offline.mode", True)
Expand Down
5 changes: 2 additions & 3 deletions esrally/utils/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,10 @@ def retrieve_content_as_string(url):
return response.read().decode("utf-8")


def has_internet_connection():
def has_internet_connection(probing_url):
logger = logging.getLogger(__name__)
try:
# We connect to Github anyway later on so we use that to avoid touching too much different remote endpoints.
probing_url = "https://github.com/"
# We try to connect to Github by default. We use that to avoid touching too much different remote endpoints.
logger.debug("Checking for internet connection against [%s]", probing_url)
# We do a HTTP request here to respect the HTTP proxy setting. If we'd open a plain socket connection we circumvent the
# proxy and erroneously conclude we don't have an Internet connection.
Expand Down