Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose _ref attribute of Compute::Network #265

Closed
pendor opened this issue Oct 27, 2020 · 1 comment · Fixed by #266
Closed

Expose _ref attribute of Compute::Network #265

pendor opened this issue Oct 27, 2020 · 1 comment · Fixed by #266

Comments

@pendor
Copy link
Contributor

pendor commented Oct 27, 2020

The get_network and get_raw_network functions in Fog::Vsphere::Compute::Real lib/fog/vsphere/requests/compute/get_network.rb accept either a Name or a _ref attribute of a network object. The Fog::Vsphere::Compute::Network object in lib/fog/vsphere/models/compute/network.rb doesn't currently expose the _ref attribute as a publicly accessible value, even though the data is present in the underlying ActiveRecord from the API call to VSphere.

The _ref attribute should be exposed so that it can be used to later call get_network with a globally unique value. Name may not be unique in some environments. Additionally, at least one client of fog-vsphere (Foreman) currently incorrectly uses the visible id attribute in place of the _ref attribute when calling get_raw_network. This works in many but not all instances as id is often but not always the same value as _ref, depending on how VSphere objects have been edited over time.

pendor added a commit to pendor/fog-vsphere that referenced this issue Oct 27, 2020
The get_network function in lib/fog/vsphere/requests/compute/get_network.rb
takes a name or _ref attribute.  This commit expose that _reg attribute
(already retrieved via previous vsphere call) so that clients of
fog-vsphere can look up network objects via the globally unique _ref
attribute instead of the non-unique Name attribute.

Additionally, this enables fixing a bug in clients where the id attribute
is incorrectly substituted for _ref, retrieving an incorrect object in
certain VSphere environments.
ezr-ondrej pushed a commit to pendor/fog-vsphere that referenced this issue Dec 8, 2020
The get_network function in lib/fog/vsphere/requests/compute/get_network.rb
takes a name or _ref attribute.  This commit expose that _reg attribute
(already retrieved via previous vsphere call) so that clients of
fog-vsphere can look up network objects via the globally unique _ref
attribute instead of the non-unique Name attribute.

Additionally, this enables fixing a bug in clients where the id attribute
is incorrectly substituted for _ref, retrieving an incorrect object in
certain VSphere environments.
ezr-ondrej pushed a commit that referenced this issue Dec 8, 2020
The get_network function in lib/fog/vsphere/requests/compute/get_network.rb
takes a name or _ref attribute.  This commit expose that _reg attribute
(already retrieved via previous vsphere call) so that clients of
fog-vsphere can look up network objects via the globally unique _ref
attribute instead of the non-unique Name attribute.

Additionally, this enables fixing a bug in clients where the id attribute
is incorrectly substituted for _ref, retrieving an incorrect object in
certain VSphere environments.
@ezr-ondrej ezr-ondrej linked a pull request Dec 9, 2020 that will close this issue
@ezr-ondrej
Copy link
Collaborator

Thanks a lot @pendor! This has been released as part of v3.5.0 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants