Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions salt/client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def gather_job_info(self, jid, tgt, tgt_type, **kwargs):
Return the information about a given job
'''
log.debug('Checking whether jid {0} is still running'.format(jid))
timeout = self.opts['gather_job_timeout']
timeout = kwargs.get('gather_job_timeout', self.opts['gather_job_timeout'])

pub_data = self.run_job(tgt,
'saltutil.find_job',
Expand Down Expand Up @@ -921,6 +921,7 @@ def get_iter_returns(

if timeout is None:
timeout = self.opts['timeout']
gather_job_timeout = kwargs.get('gather_job_timeout', self.opts['gather_job_timeout'])
start = int(time.time())

# timeouts per minion, id_ -> timeout time
Expand Down Expand Up @@ -1019,7 +1020,7 @@ def get_iter_returns(
jinfo_iter = []
else:
jinfo_iter = self.get_returns_no_block('salt/job/{0}'.format(jinfo['jid']))
timeout_at = time.time() + self.opts['gather_job_timeout']
timeout_at = time.time() + gather_job_timeout
# if you are a syndic, wait a little longer
if self.opts['order_masters']:
timeout_at += self.opts.get('syndic_wait', 1)
Expand Down
19 changes: 15 additions & 4 deletions salt/runners/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
FINGERPRINT_REGEX = re.compile(r'^([a-f0-9]{2}:){15}([a-f0-9]{2})$')


def status(output=True):
def status(output=True, timeout=None, gather_job_timeout=None):
'''
Print the status of all known salt minions

Expand All @@ -42,8 +42,14 @@ def status(output=True):
'''
ret = {}
client = salt.client.get_local_client(__opts__['conf_file'])

if not timeout:
timeout = __opts__['timeout']
if not gather_job_timeout:
gather_job_timeout = __opts__['gather_job_timeout']

try:
minions = client.cmd('*', 'test.ping', timeout=__opts__['timeout'])
minions = client.cmd('*', 'test.ping', timeout=timeout, gather_job_timeout=gather_job_timeout)
except SaltClientError as client_error:
print(client_error)
return ret
Expand Down Expand Up @@ -128,7 +134,7 @@ def down(removekeys=False):
return ret


def up(): # pylint: disable=C0103
def up(timeout=None, gather_job_timeout=None): # pylint: disable=C0103
'''
Print a list of all of the minions that are up

Expand All @@ -137,8 +143,13 @@ def up(): # pylint: disable=C0103
.. code-block:: bash

salt-run manage.up
salt-run manage.up timeout=5 gather_job_timeout=5
'''
ret = status(output=False).get('up', [])
ret = status(
output=False,
timeout=timeout,
gather_job_timeout=gather_job_timeout
).get('up', [])
return ret


Expand Down