Skip to content

Commit

Permalink
Fixed AttributeError when using 'storage_groups' on 'Client' object
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <[email protected]>
  • Loading branch information
andy-maier committed Jul 29, 2024
1 parent ee6ab65 commit 9bd3846
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion zhmc_prometheus_exporter/zhmc_prometheus_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 9bd3846

Please sign in to comment.