diff --git a/confluent_client/doc/man/nodeattrib.ronn.tmpl b/confluent_client/doc/man/nodeattrib.ronn.tmpl index cbe91380..6ab50c60 100644 --- a/confluent_client/doc/man/nodeattrib.ronn.tmpl +++ b/confluent_client/doc/man/nodeattrib.ronn.tmpl @@ -54,6 +54,14 @@ Additionally, if wanting to change from a node level attribute value to inherit member group, it is required to use '-c' to clear the attribute. Conversely, assigning to a blank value will allow masking a group defined attribute with an empty value. +## ALIASES + +The following short names expand to their full attribute names: + +* `bmc` expands to `hardwaremanagement.manager` +* `bmcuser` and `switchuser` expand to `secret.hardwaremanagementuser` +* `bmcpass` and `switchpass` expand to `secret.hardwaremanagementpassword` + ## OPTIONS * `-b`, `--blame`: diff --git a/confluent_client/doc/man/nodeshell.ronn b/confluent_client/doc/man/nodeshell.ronn index b29e6d97..59199640 100644 --- a/confluent_client/doc/man/nodeshell.ronn +++ b/confluent_client/doc/man/nodeshell.ronn @@ -17,6 +17,9 @@ as stderr, unlike psh which combines all stdout and stderr into stdout. * `-c COUNT`, `-f COUNT`, `--count=COUNT` Specify the maximum number of instances to run concurrently +* `-e ENVVAR`, `--environmentpassword=ENVVAR` + Environment variable containing the password to use for ssh + * `-l LOGINNAME`, `--loginname=LOGINNAME` Username to use when connecting, defaults to current user. @@ -40,6 +43,9 @@ as stderr, unlike psh which combines all stdout and stderr into stdout. * `-t TIMEOUT`, `--timeout=TIMEOUT` Timeout in seconds for each node ssh connection attempt +* `-x`, `--noexpression` + Suppress confluent attribute expression expansion of the command + ## EXAMPLES * Running `echo hi` on for nodes: diff --git a/confluent_server/confluent/discovery/core.py b/confluent_server/confluent/discovery/core.py index 8b69f218..ea9e2436 100644 --- a/confluent_server/confluent/discovery/core.py +++ b/confluent_server/confluent/discovery/core.py @@ -776,9 +776,11 @@ async def _recheck_nodes_backend(nodeattribs, configmanager): continue # now we go through ones that were identified, but could not pass # policy or hadn't been able to verify key - for nodename in pending_nodes: + for nodename in list(pending_nodes): await asyncio.sleep(0) - info = pending_nodes[nodename] + info = pending_nodes.get(nodename, None) + if info is None: + continue try: if info['handler'] is None: continue diff --git a/confluent_server/confluent/exceptions.py b/confluent_server/confluent/exceptions.py index c359e40d..2bb60654 100644 --- a/confluent_server/confluent/exceptions.py +++ b/confluent_server/confluent/exceptions.py @@ -122,7 +122,7 @@ class GlobalConfigError(ConfluentException): class TargetResourceUnavailable(ConfluentException): # This is meant for scenarios like asking to read a sensor that is # currently unavailable. This may be a persistent or transient state - apierrocode = 503 + apierrorcode = 503 _apierrorstr = 'Target Resource Unavailable' class PubkeyInvalid(ConfluentException): diff --git a/confluent_server/confluent/messages.py b/confluent_server/confluent/messages.py index c86df63a..ef8912e0 100644 --- a/confluent_server/confluent/messages.py +++ b/confluent_server/confluent/messages.py @@ -296,7 +296,7 @@ class ConfluentResourceUnavailable(ConfluentNodeError): defaulterror = 'Unavailable' def strip_node(self, node): - raise exc.TargetResourceUnavailable() + raise exc.TargetResourceUnavailable(self.error) class ConfluentTargetTimeout(ConfluentNodeError): diff --git a/confluent_server/confluent/plugins/hardwaremanagement/geist.py b/confluent_server/confluent/plugins/hardwaremanagement/geist.py index cb7bea1e..da9a546d 100644 --- a/confluent_server/confluent/plugins/hardwaremanagement/geist.py +++ b/confluent_server/confluent/plugins/hardwaremanagement/geist.py @@ -107,6 +107,16 @@ class GeistClient(object): ) self._token = None + async def get_outlet_ids(self): + rsp = await self.wc.grab_json_response('/api/dev') + dbt = data_by_type(rsp['data']) + if 't3hd' in dbt: + del dbt['t3hd'] + if len(dbt) != 1: + raise Exception('Multiple PDUs not supported per pdu') + pdutype = list(dbt)[0] + return sorted(int(idx) + 1 for idx in dbt[pdutype].get('outlet', {})) + async def get_outlet(self, outlet): rsp = await self.wc.grab_json_response('/api/dev') rsp = rsp['data'] @@ -238,6 +248,12 @@ async def read_sensors(element, node, configmanager): return msg.SensorReadings(readings, name=node) +async def list_outlets(node, configmanager): + gc = GeistClient(node, configmanager) + for idx in await gc.get_outlet_ids(): + yield msg.ChildCollection(str(idx)) + + async def get_outlet(element, node, configmanager): gc = GeistClient(node, configmanager) state = await gc.get_outlet(element[-1]) @@ -302,6 +318,11 @@ async def read_inventory(element, node, configmanager): async def retrieve(nodes, element, configmanager, inputdata): if 'outlets' in element: + if element[-1] == 'outlets': + for node in nodes: + async for res in list_outlets(node, configmanager): + yield res + return gp = tasks.TaskPile(pdupool) for node in nodes: gp.spawn(get_outlet, element, node, configmanager) diff --git a/confluent_server/confluent/vinzmanager.py b/confluent_server/confluent/vinzmanager.py index 769d3e8a..ed7fb97f 100644 --- a/confluent_server/confluent/vinzmanager.py +++ b/confluent_server/confluent/vinzmanager.py @@ -142,6 +142,8 @@ async def send_grant(conn, nodename, rqtype): 'secret.hardwaremanagementpassword', {}).get('value', None) host = c.get(nodename, {}).get( 'hardwaremanagement.manager', {}).get('value', None) + if host: + host = host.split('/', 1)[0] if bmcuser and bmcpass and host: kv = util.TLSCertVerifier(cfg, nodename, 'pubkeys.tls_hardwaremanager').verify_cert