2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-03-31 22:43:32 +00:00

Replace some pyghmi references and modernize some asyncio invocations

This commit is contained in:
Jarrod Johnson
2026-01-21 16:45:42 -05:00
parent b2f1b8da79
commit 7fedbc1810
12 changed files with 25 additions and 15 deletions

View File

@@ -60,4 +60,4 @@ async def main():
sys.exit(exitcode)
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
asyncio.run(main())

View File

@@ -438,4 +438,4 @@ async def main():
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
asyncio.run(main())

View File

@@ -74,4 +74,4 @@ async def main():
sys.exit(exitcode)
if __name__ == '__main__':
asyncio.get_event_loop().run_until_complete(main())
asyncio.run(main())

View File

@@ -19,7 +19,8 @@ try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
webclient = eventlet.import_patched('pyghmi.util.webclient')
import aiohmi.util.webclient as webclient
class NodeHandler(bmchandler.NodeHandler):
DEFAULT_USER = 'admin'

View File

@@ -14,8 +14,8 @@
import codecs
import confluent.discovery.handlers.bmc as bmchandler
import pyghmi.exceptions as pygexc
import pyghmi.ipmi.private.util as pygutil
import aiohmi.exceptions as pygexc
import aiohmi.ipmi.private.util as pygutil
import confluent.util as util
import struct

View File

@@ -16,7 +16,9 @@ import codecs
import confluent.discovery.handlers.bmc as bmchandler
import confluent.exceptions as exc
import eventlet
webclient = eventlet.import_patched('pyghmi.util.webclient')
import aiohmi.util.webclient as webclient
import struct
try:
from urllib import urlencode

View File

@@ -16,8 +16,6 @@ import confluent.discovery.handlers.redfishbmc as redfishbmc
import eventlet.support.greendns
import confluent.util as util
webclient = eventlet.import_patched('pyghmi.util.webclient')
getaddrinfo = eventlet.support.greendns.getaddrinfo

View File

@@ -94,7 +94,7 @@ def lenovoname(idx, desc):
return desc
nameoverrides = [
(re.compile('20301\..*'), lenovoname),
(re.compile(r'20301\..*'), lenovoname),
]
# Lenovo chassis id rule is match only first 5 bytes for a match.....

View File

@@ -2,7 +2,9 @@
import confluent.util as util
import time
import eventlet
webclient = eventlet.import_patched('pyghmi.util.webclient')
import aiohmi.util.webclient as webclient
_healthmap = {
'normal': 'ok',

View File

@@ -1308,7 +1308,7 @@ if __name__ == '__main__':
os.umask(0o022)
if len(sys.argv) > 2:
mfd = os.environ.get('CONFLUENT_MEDIAFD', None)
asyncio.get_event_loop().run_until_complete(import_image(sys.argv[1], callback=printit, backend=True, mfd=mfd, custtargpath=sys.argv[3], custdistpath=sys.argv[4], custname=sys.argv[5]))
asyncio.run(import_image(sys.argv[1], callback=printit, backend=True, mfd=mfd, custtargpath=sys.argv[3], custdistpath=sys.argv[4], custname=sys.argv[5]))
else:
asyncio.get_event_loop().run_until_complete(import_image(sys.argv[1], callback=printit))
asyncio.run(import_image(sys.argv[1], callback=printit))

View File

@@ -30,6 +30,13 @@ import aiohmi.redfish.command as rcmd
import aiohmi.util.webclient as webclient
import aiohttp
try:
raise Exception('TODO: Migrate to aiohttp websocket')
websocket = eventlet.import_patched('websocket')
wso = websocket.WebSocket
except Exception:
wso = object
class CustomVerifier(aiohttp.Fingerprint):
def __init__(self, verifycallback):
self._certverify = verifycallback

View File

@@ -23,8 +23,8 @@ import confluent.exceptions as cexc
import confluent.interface.console as conapi
import confluent.log as log
import confluent.util as util
import pyghmi.exceptions as pygexc
import pyghmi.redfish.command as rcmd
import aiohmi.exceptions as pygexc
import aiohmi.redfish.command as rcmd
import eventlet
import eventlet.green.ssl as ssl
try: