Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Closes Issue 595 (#597)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdvickst authored and chambridge committed Aug 28, 2018
1 parent 25d32c6 commit ed9ac1f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -22,3 +22,5 @@ doc/source/rho.rst
.coverage
.vagrant
*.retry

.vscode/
11 changes: 10 additions & 1 deletion rho/host_discovery.py
Expand Up @@ -21,6 +21,8 @@
PING_LOG_PATH,
process_discovery_scan)

DEFAULT_DISCOVERY_TIMEOUT = 20


def process_ping_output(out_lines):
"""Find successful hosts from the output of a ping command.
Expand Down Expand Up @@ -138,7 +140,14 @@ def create_ping_inventory(vault, vault_pass, profile_ranges, profile_port,
ansible_utils.log_yaml_inventory('Ping inventory', yml_dict)

total_hosts_count = len(all_hosts)
rho_discovery_timeout = os.getenv('RHO_DISCOVERY_TIMEOUT', 5)
rho_discovery_timeout = os.getenv(
'RHO_DISCOVERY_TIMEOUT', DEFAULT_DISCOVERY_TIMEOUT)

try:
rho_discovery_timeout = int(rho_discovery_timeout)
except ValueError:
rho_discovery_timeout = DEFAULT_DISCOVERY_TIMEOUT

discovery_timeout = ((total_hosts_count // int(forks)) + 1) \
* rho_discovery_timeout

Expand Down
11 changes: 10 additions & 1 deletion rho/inventory_scan.py
Expand Up @@ -23,6 +23,8 @@
from rho.translation import _ as t
from rho.utilities import str_to_ascii

DEFAULT_HOST_SCAN_TIMEOUT = 30


# Creates the filtered main inventory on which the custom
# modules to collect facts are run. This inventory can be
Expand Down Expand Up @@ -313,7 +315,14 @@ def inventory_scan(hosts_yml_path, facts_to_collect, report_path,
forks=forks,
vars=json.dumps(ansible_vars))

rho_host_scan_timeout = os.getenv('RHO_HOST_SCAN_TIMEOUT', 10)
rho_host_scan_timeout = os.getenv(
'RHO_HOST_SCAN_TIMEOUT', DEFAULT_HOST_SCAN_TIMEOUT)

try:
rho_host_scan_timeout = int(rho_host_scan_timeout)
except ValueError:
rho_host_scan_timeout = DEFAULT_HOST_SCAN_TIMEOUT

host_scan_timeout = ((len(hosts) // int(forks)) + 1) \
* rho_host_scan_timeout
utilities.log.info('Starting scan for group "%s" with %d systems'
Expand Down

0 comments on commit ed9ac1f

Please sign in to comment.