Skip to content

Conversation

@larsks
Copy link
Member

@larsks larsks commented Jan 24, 2025

OpenStackConfig.get_all() will fail with a keystone exception if there are
any OS_* variables set in the environment 1. This is easy to trigger if,
for example, you have set OS_BAREMETAL_API_VERSION in your environment to
work around 2.

We can avoid the problem by removing the call to get_all(), and
instead initializing the list of clouds using get_cloud_names().

This commit makes a number of additional changes to
esiclient/v1/mdc/mdc_node_baremetal.py:

  • Several attribute names appear to have changed since this code was
    written (node.uuid is now node.id; node.instance_uuid is now
    node.instance_id).

  • Replace single-letter variable names with more meaningful names.

  • Add the '--ignore-invalid' command, which allows the command to continue
    in the event that it cannot successfully connect to one or more clouds.

@larsks larsks changed the title fix/mdc Make "esi mdc baremetal node list" work Jan 24, 2025
@larsks
Copy link
Member Author

larsks commented Jan 24, 2025

This PR was sort of an accident, because I was looking at setup.cfg and found myself asking, "what the heck is this mdc subcommand?".

OpenStackConfig.get_all() will fail with a keystone exception if there are
any OS_* variables set in the environment [1]. This is easy to trigger if,
for example, you have set OS_BAREMETAL_API_VERSION in your environment to
work around [2].

We can avoid the problem by removing the call to get_all(), and
instead initializing the list of clouds using get_cloud_names().

This commit makes a number of additional changes to
esiclient/v1/mdc/mdc_node_baremetal.py:

- Several attribute names appear to have changed since this code was
  written (node.uuid is now node.id; node.instance_uuid is now
  node.instance_id).

- Replace single-letter variable names with more meaningful names.

- Add the '--ignore-invalid' command, which allows the command to continue
  in the event that it cannot successfully connect to one or more clouds.

[1]: https://bugs.launchpad.net/openstacksdk/+bug/2096621
[2]: CCI-MOC/esi#669
@joachimweyl
Copy link

@tzumainn saw this while I was reviewing PRs.

@tzumainn
Copy link
Contributor

@larsks Oh, ha, it was a sort of experimental thing created in the wilder days of ESI that has never become useful. I like your changes; however I also think maybe this code should just be removed as irrelevant - what do you think?

@larsks
Copy link
Member Author

larsks commented Feb 10, 2025

I guess I would say (a) merge this code then (b) submit a new pr removing the command. This way the fixed code exists if somebody ever wants to go looking for it.

@tzumainn
Copy link
Contributor

sounds good!

@tzumainn tzumainn merged commit da70c6d into CCI-MOC:master Feb 10, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants