From e00bc7a4bc05b20be26441d9795c06a9ef3e4b41 Mon Sep 17 00:00:00 2001 From: Michael Fritch Date: Wed, 4 Mar 2020 15:30:03 -0700 Subject: [PATCH] cephadm: add type checking to `update_filewalld` fixes mypy errors: cephadm:1682: error: Incompatible types in assignment (expression has type "str", variable has type "int") cephadm:1683: error: List item 3 has incompatible type "int"; expected "str" cephadm:1686: error: List item 3 has incompatible type "int"; expected "str" Found 3 errors in 1 file (checked 1 source file) Signed-off-by: Michael Fritch --- src/cephadm/cephadm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index f75babd9d6b2f..ce27ae77a7e29 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -1635,6 +1635,7 @@ def deploy_daemon_units(fsid, uid, gid, daemon_type, daemon_id, c, call_throws(['systemctl', 'start', unit_name]) def update_firewalld(daemon_type): + # type: (str) -> None if args.skip_firewalld: return cmd = find_executable('firewall-cmd') @@ -1672,16 +1673,16 @@ def update_firewalld(daemon_type): else: logger.debug('firewalld service %s is enabled in current zone' % svc) for port in fw_ports: - port = str(port) + '/tcp' - out, err, ret = call([cmd, '--permanent', '--query-port', port]) + tcp_port = str(port) + '/tcp' + out, err, ret = call([cmd, '--permanent', '--query-port', tcp_port]) if ret: - logger.info('Enabling firewalld port %s in current zone...' % port) - out, err, ret = call([cmd, '--permanent', '--add-port', port]) + logger.info('Enabling firewalld port %s in current zone...' % tcp_port) + out, err, ret = call([cmd, '--permanent', '--add-port', tcp_port]) if ret: raise RuntimeError('unable to add port %s to current zone: %s' % - (port, err)) + (tcp_port, err)) else: - logger.debug('firewalld port %s is enabled in current zone' % port) + logger.debug('firewalld port %s is enabled in current zone' % tcp_port) call_throws([cmd, '--reload']) def install_base_units(fsid): -- 2.39.5