mirror of
https://github.com/xcat2/confluent.git
synced 2026-08-03 16:07:00 +00:00
Complete the async port of the nodegroup attribute paths
simple_nodegroups_command awaited the async generators returned by read and update, which raises TypeError: 'async_generator' object can't be awaited and printgroupattributes was left synchronous, iterating one of those generators with plain for. Neither is reachable yet, since nodeattrib only ever passes a noderange and nodegroupattrib still uses the traditional client, but they are the paths nodegroupattrib will use once it is ported.
This commit is contained in:
@@ -347,12 +347,12 @@ class Command(object):
|
||||
else:
|
||||
ikey = key
|
||||
if input is None:
|
||||
for res in await self.read('/nodegroups/{0}/{1}'.format(
|
||||
async for res in self.read('/nodegroups/{0}/{1}'.format(
|
||||
noderange, resource)):
|
||||
rc = self.handle_results(ikey, rc, res)
|
||||
else:
|
||||
kwargs[ikey] = input
|
||||
for res in await self.update('/nodegroups/{0}/{1}'.format(
|
||||
async for res in self.update('/nodegroups/{0}/{1}'.format(
|
||||
noderange, resource), kwargs):
|
||||
rc = self.handle_results(ikey, rc, res)
|
||||
return rc
|
||||
@@ -667,10 +667,10 @@ def show_attr(attr, requestargs, seenattributes, options, node):
|
||||
return processattr
|
||||
|
||||
|
||||
def printgroupattributes(session, requestargs, showtype, nodetype, noderange, options):
|
||||
async def printgroupattributes(session, requestargs, showtype, nodetype, noderange, options):
|
||||
exitcode = 0
|
||||
seenattributes = set([])
|
||||
for res in session.read('/{0}/{1}/attributes/{2}'.format(nodetype, noderange, showtype)):
|
||||
async for res in session.read('/{0}/{1}/attributes/{2}'.format(nodetype, noderange, showtype)):
|
||||
if 'error' in res:
|
||||
sys.stderr.write(res['error'] + '\n')
|
||||
exitcode = 1
|
||||
|
||||
Reference in New Issue
Block a user