2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-08-28 17:46:42 +00:00

Merge pull request #271 from Obihoernchen/fix/type-checker-findings

Fix/type checker findings
This commit is contained in:
Jarrod Johnson
2026-08-11 07:54:18 -04:00
committed by GitHub
10 changed files with 21 additions and 81 deletions
+3 -1
View File
@@ -189,13 +189,15 @@ class OEMHandler(object):
if False:
yield None
async def get_diagnostic_data(self, savefile, progress=None):
async def get_diagnostic_data(self, savefile, progress=None,
autosuffix=False):
"""Download diagnostic data about target to a file
This should be a payload that the vendor's support team can use
to do diagnostics.
:param savefile: File object or filename to save to
:param progress: Callback to be informed about progress
:param autosuffix: Whether to append a vendor suffix to savefile
:return:
"""
raise exc.UnsupportedFunctionality(
@@ -222,7 +222,8 @@ class OEMHandler(generic.OEMHandler):
async def remove_storage_configuration(self, cfgspec):
if await self.has_xcc():
return await self.immhandler.remove_storage_configuration(cfgspec)
return await super(OEMHandler, self).remove_storage_configuration()
return await super(OEMHandler, self).remove_storage_configuration(
cfgspec)
async def get_ikvm_methods(self):
if await self.has_xcc():
@@ -241,7 +242,8 @@ class OEMHandler(generic.OEMHandler):
async def apply_storage_configuration(self, cfgspec):
if await self.has_xcc():
return await self.immhandler.apply_storage_configuration(cfgspec)
return await super(OEMHandler, self).apply_storage_configuration()
return await super(OEMHandler, self).apply_storage_configuration(
cfgspec)
async def check_storage_configuration(self, cfgspec):
if await self.has_xcc():
@@ -1371,7 +1371,7 @@ class OEMHandler(generic.OEMHandler):
while not complete and retry > 0:
try:
pgress = await self._do_web_request(monitorurl, cache=False)
except socket.socket:
except socket.error:
pgress = None
if not pgress:
retry -= 1
@@ -1739,7 +1739,7 @@ class OEMHandler(generic.OEMHandler):
deltarget = '{0},{1}'.format(uid, uidtonamemap[uid])
await wc.grab_json_response('/api/function', {"USER_UserDelete": deltarget})
return True
return await super(OEMHandler, self).user_delete(uid)
return await super(OEMHandler, self).user_delete(uid, fishclient)
async def get_user_expiration(self, uid):
wc = await self.wc()
-40
View File
@@ -1,40 +0,0 @@
#!/usr/bin/python2
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2014 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
import os
path = os.path.dirname(os.path.realpath(__file__))
path = os.path.realpath(os.path.join(path, '..', 'lib', 'python'))
if path.startswith('/opt'):
# if installed into system path, do not muck with things
sys.path.append(path)
import confluent.main
#import cProfile
#import time
#p = cProfile.Profile(time.clock)
#p.enable()
#try:
import multiprocessing
if __name__ == '__main__':
multiprocessing.freeze_support()
confluent.main.run()
#except:
# pass
#p.disable()
#p.print_stats(sort='cumulative')
#p.print_stats(sort='time')
@@ -186,7 +186,8 @@ class NodeHandler(object):
if self.relay_url:
kv = util.TLSCertVerifier(self.configmanager, self.relay_server,
'pubkeys.tls_hardwaremanager').verify_cert
w = webclient.WebConnection(self.relay_server, verifycallback=kv)
w = webclient.WebConnection(self.relay_server, verifycallback=kv,
port=443)
relaycreds = self.configmanager.get_node_attributes(self.relay_server, 'secret.*', decrypt=True)
relaycreds = relaycreds.get(self.relay_server, {})
relayuser = relaycreds.get('secret.hardwaremanagementuser', {}).get('value', None)
@@ -64,7 +64,7 @@ class NodeHandler(immhandler.NodeHandler):
if lla:
for idx in util.list_interface_indexes():
tmplla = '{0}%{1}'.format(lla, idx)
addr = (await cloop.getaddrinfo(tmplla, 443, 0, socket.SOCK_STREAM))[0][4]
addr = (await cloop.getaddrinfo(tmplla, 443, type=socket.SOCK_STREAM))[0][4]
try:
tsock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
tsock.setblocking(0)
@@ -329,7 +329,8 @@ async def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
if await netutil.ip_on_same_subnet(theip, 'fe80::', 64):
if '%' in peer[0]:
ifidx = peer[0].split('%', 1)[1]
iface = (await cloop.getaddrinfo(peer[0], 0, socket.AF_INET6, socket.SOCK_DGRAM))[0][-1][-1]
iface = (await cloop.getaddrinfo(peer[0], 0, family=socket.AF_INET6,
type=socket.SOCK_DGRAM))[0][-1][-1]
else:
ifidx = '{}'.format(peer[-1])
iface = peer[-1]
@@ -390,7 +391,7 @@ async def _find_service(service, target):
cloop.add_reader(net4, _relay_pkt, net4, pktq)
cloop.add_reader(net6, _relay_pkt, net6, pktq)
if target:
addrs = await cloop.getaddrinfo(target, 1900, 0, socket.SOCK_DGRAM)
addrs = await cloop.getaddrinfo(target, 1900, type=socket.SOCK_DGRAM)
for addr in addrs:
host = addr[4][0]
if addr[0] == socket.AF_INET:
@@ -1053,7 +1053,9 @@ class IpmiHandler:
await self.make_inventory_map()
compname = self.invmap.get(component, None)
if compname is None:
await self.output.put(msg.ConfluentTargetNotFound())
await self.output.put(msg.ConfluentTargetNotFound(
self.node,
"No component named '{0}' found".format(component)))
return
invdata = await self.ipmicmd.get_inventory_of_component(compname)
if invdata is None:
@@ -975,7 +975,9 @@ class IpmiHandler:
await self.make_inventory_map()
compname = self.invmap.get(component, None)
if compname is None:
await self.output.put(msg.ConfluentTargetNotFound())
await self.output.put(msg.ConfluentTargetNotFound(
self.node,
"No component named '{0}' found".format(component)))
return
invdata = await self.ipmicmd.get_inventory_of_component(compname)
if invdata is None:
-30
View File
@@ -1,30 +0,0 @@
# -*- mode: python -*-
block_cipher = None
a = Analysis(['c:/Python27/Scripts/confluentsrv.py'],
pathex=[],
hiddenimports=[], # ['pyghmi.constants', 'pyghmi.exceptions', 'pyghmi.ipmi.console', 'pyghmi.ipmi.private.constants', 'pyghmi.ipmi.private', 'pyghmi.ipmi.private.session', 'pyghmi.ipmi.command', 'pyghmi.ipmi.events', 'pyghmi.ipmi.fru', 'pyghmi.ipmi.private.spd', 'pyghmi.ipmi.oem.lookup', 'pyghmi.ipmi.oem.generic', 'pyghmi.ipmi.oem.lenovo', 'pyghmi.ipmi.private.util', 'pyghmi.ipmi.sdr'],
hookspath=None,
runtime_hooks=None,
excludes=None,
cipher=block_cipher)
pyz = PYZ(a.pure,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='confluentsrv.exe',
debug=False,
strip=None,
upx=True,
console=True )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
Tree('confluent/plugins', prefix='confluent/plugins'),
strip=None,
upx=True,
name='confluentsrv')