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

V3.2.1 Patch NSX-T Rest Python code to make it works (but not idempotent) with NSX-T when _revision is missing #461

Open
wants to merge 1 commit into
base: v3.2.0
Choose a base branch
from

Conversation

smesguich-orange
Copy link

Hello

NSX-T Rest API module is not working for NSX-T under 3.2.
This is related to the _revision attribute of object in NSX-T which are not on every object.
This modification let the module edit object without _revision attribute but display warning that idempotance is not guaranteed.

Minor bugfix for NSX-T V3.2.0 module version but make its works on NSX-T under 3.2 version.

Tested on v3.1.3

…ent) with NSX-T when _revision is missing

Signed-off-by: Samuel MESGUICH <samuel.mesguich@orange.com>
Copy link
Member

@salv-orlando salv-orlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR!

I reckon it might be important to identify which resources are not returning the _revision attribute to figure out if there are alternate way of identifying whether there was a change (e.g.: last_update_time, resource data hash, etc)

else:
self.module.warn("_revision key in dict is missing")
self.module.warn("Count change but possibly nothing change. Cause : _revision key in dict is missing.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log statement at line 240 seems redundant.

This can probably be rephrased to something like "Defaulting to changed=True because resource %s does not have _revision attribute" % self._path

if before_resp:
before_revision = ""

if before_resp and "_revision" in before_resp :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion

if before_resp:
before_revision = before_resp.get('_revision', '')

This might simplify a little the logic

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.

2 participants