-
Notifications
You must be signed in to change notification settings - Fork 12
Make the "port forwarding create" command idempotent #89
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
Conversation
|
After this merges we should push a new release to pypi. |
|
Curses, need to update the tests. |
06f5b07 to
9caf7f0
Compare
|
Tests are updated! |
tzumainn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well - two minor comments/questions!
9caf7f0 to
f669899
Compare
The `port forwarding create` command would exit with an error
if you attempted to create a forwarding configuration that already exists.
This made it difficult to identify actual failures.
This commit updates the `port forwarding create` command so that it is not
an error if the requested forwarding already exists.
The old behavior was:
$ openstack esi port forwarding create 192.168.11.31 128.31.20.118 -p 8888
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
| ID | Internal Port | External Port | Protocol | Internal IP | External IP |
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
| 43c96be3-861d-4818-a32a-079a93b6f9c4 | 8888 | 8888 | tcp | 192.168.11.31 | 128.31.20.118 |
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
$ openstack esi port forwarding create esi-MOC-R4PAC24U35-S1B-provisioning 128.31.20.118 -p 8888 -p 8889
BadRequestException: 400: Client Error for url:
https://esi.massopen.cloud:13696/v2.0/floatingips/be4b2718-ec5f-4722-80b5-485c421e4a72/port_forwardings,
Bad port_forwarding request: A duplicate port forwarding entry with
same attributes already exists, conflicting values are
{'floatingip_id': 'be4b2718-ec5f-4722-80b5-485c421e4a72',
'external_port': 8888, 'protocol': 'tcp'}.
The new behavior looks like this:
$ openstack esi port forwarding create 192.168.11.31 128.31.20.118 -p 8888
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
| ID | Internal Port | External Port | Protocol | Internal IP | External IP |
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
| 43c96be3-861d-4818-a32a-079a93b6f9c4 | 8888 | 8888 | tcp | 192.168.11.31 | 128.31.20.118 |
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
$ openstack esi port forwarding create esi-MOC-R4PAC24U35-S1B-provisioning 128.31.20.118 -p 8888 -p 8889
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
| ID | Internal Port | External Port | Protocol | Internal IP | External IP |
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
| exists | 8888 | 8888 | tcp | 192.168.11.31 | 128.31.20.118 |
| d7d56201-232a-41fe-8ae6-1f6fb88a37d3 | 8889 | 8889 | tcp | 192.168.11.31 | 128.31.20.118 |
+--------------------------------------+---------------+---------------+----------+---------------+---------------+
f669899 to
900d169
Compare
tzumainn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works perfect - thanks!
|
new release pushed to pypi |
We use the `openstack esi port forwarding` command in the `external_access` role to configure port forwarding. Previously, this command would fail with an error when attempting to create a port forwarding that already exists. This made it difficult to identify legitimate failures. With CCI-MOC/python-esiclient#89, python-esiclient is now idempotent and will not emit an error if an existing port forwarding exactly matches the requested configuration.
We use the `openstack esi port forwarding` command in the `external_access` role to configure port forwarding. Previously, this command would fail with an error when attempting to create a port forwarding that already exists. This made it difficult to identify legitimate failures. With CCI-MOC/python-esiclient#89, python-esiclient is now idempotent and will not emit an error if an existing port forwarding exactly matches the requested configuration.
The
port forwarding createcommand would exit with an error if you attempted to create a forwarding configuration that already exists. This made it difficult to identify actual failures.This commit updates the
port forwarding createcommand so that it is not an error if the requested forwarding already exists.The old behavior was:
The new behavior looks like this: