Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

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
smesguich-orange wants to merge 1 commit into
vmware-archive:v3.2.0from
smesguich-orange:v3.2.0
Open

V3.2.1 Patch NSX-T Rest Python code to make it works (but not idempotent) with NSX-T when _revision is missing#461
smesguich-orange wants to merge 1 commit into
vmware-archive:v3.2.0from
smesguich-orange:v3.2.0

Conversation

@smesguich-orange

Copy link
Copy Markdown

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>

@salv-orlando salv-orlando left a comment

Copy link
Copy Markdown

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)

self.module.exit_json(changed=False, body=after_resp)
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
Copy Markdown

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
Copy Markdown

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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants