From 235b5a72cd5c1d5b657c3e4ceed338cf542c669c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristoffer=20Gr=C3=B6nlund?= Date: Fri, 21 Feb 2020 23:20:03 +0100 Subject: [PATCH] cephadm: Improve type signature of is_available MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Specify the function signature expected by `is_available` using the mypy Callable type. Signed-off-by: Kristoffer Grönlund --- src/cephadm/cephadm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 152fda85a6f..518f62bc0e3 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -52,7 +52,7 @@ import tempfile import time import errno try: - from typing import Dict, List, Tuple, Optional, Union, Any, NoReturn + from typing import Dict, List, Tuple, Optional, Union, Any, NoReturn, Callable except ImportError: pass import uuid @@ -556,7 +556,7 @@ def call_timeout(command, timeout): ################################## def is_available(what, func): - # type: (str, Any) -> Any + # type: (str, Callable[..., bool]) -> Callable[..., None] """ Wait for a service to become available @@ -1870,6 +1870,7 @@ def command_bootstrap(): # wait for the service to become available def is_mon_available(): + # type: () -> bool timeout=args.timeout if args.timeout else 30 # seconds out, err, ret = call(c.run_cmd(), desc=c.entrypoint, @@ -1928,6 +1929,7 @@ def command_bootstrap(): # wait for the service to become available logger.info('Waiting for mgr to start...') def is_mgr_available(): + # type: () -> bool timeout=args.timeout if args.timeout else 30 # seconds out = cli(['status', '-f', 'json-pretty'], timeout=timeout) j = json.loads(out) @@ -1978,6 +1980,7 @@ def command_bootstrap(): # wait for the service to become available logger.info('Waiting for the dashboard to start...') def is_dashboard_available(): + # type: () -> bool timeout=args.timeout if args.timeout else 30 # seconds out = cli(['-h'], timeout=timeout) return 'dashboard' in out -- 2.39.5