diff --git a/docs/changes.rst b/docs/changes.rst index 887740ae..6cce3cf9 100644 --- a/docs/changes.rst +++ b/docs/changes.rst @@ -40,6 +40,8 @@ Released: not yet * Dev: Added missing development requirement for 'filelock' package. +* Fixed AttributeError when using 'storage_groups' on 'Client' object. + **Enhancements:** * Docs: Added a section about the size of captured terminal output and log diff --git a/zhmc_prometheus_exporter/zhmc_prometheus_exporter.py b/zhmc_prometheus_exporter/zhmc_prometheus_exporter.py index 17668aed..f92c07fb 100755 --- a/zhmc_prometheus_exporter/zhmc_prometheus_exporter.py +++ b/zhmc_prometheus_exporter/zhmc_prometheus_exporter.py @@ -1104,7 +1104,13 @@ def uri_to_resource(client, uri2resource, uri): m = re.match(r'(/api/storage-groups/[a-f0-9\-]+)$', uri) if m is not None: # Resource URI is for a storage group - stogrp = client.storage_groups.resource_object(uri) + console = client.consoles.console + stogrp = console.storage_groups.resource_object(uri) + # Get the CPC via 'uri2resource()' because that avoids the + # "Get CPC Properties" operation that is performed when getting it + # via the 'cpc' property on the storage group object. + cpc_uri = stogrp.get_property('cpc-uri') + cpc = uri_to_resource(client, uri2resource, cpc_uri) logprint(logging.INFO, PRINT_V, "Adding storage group {}.{} after exporter start for " "fast lookup".format(cpc.name, stogrp.name))