Skip to content

Commit 10f23ae

Browse files
author
earthmant
committed
fix flake8
fix issue fix from pr another fix fix another something trying that fix another izsue fix another
1 parent 50965b5 commit 10f23ae

File tree

4 files changed

+32
-6
lines changed

4 files changed

+32
-6
lines changed

CHANGELOG.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
3.2.17: Support no networks.
2+
3.2.16:
3+
- Update wagon builder to py2py3 wagon.
4+
- Added 5.1.0 integration tests.
15
3.2.14: Support Python 3.
26
3.2.13:
37
- Support quota operations on Project [ get_quota/update_quota ].

openstack_plugin/resources/compute/server.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -872,6 +872,22 @@ def _update_nics_config(server_config, client_config, allow_multiple=False):
872872
# valid only when one network created for the current tenant, the server
873873
# will attach automatically to that network
874874
if not (nics_from_node or nics_from_rels):
875+
compute_api_version = client_config.get('compute_api_version')
876+
compute_microversion = client_config.get(
877+
'compute_default_microversion')
878+
if compute_api_version:
879+
compute_api_version = float(compute_api_version)
880+
if compute_microversion:
881+
compute_microversion = float(compute_microversion)
882+
if any([compute_api_version >= 2.37, compute_microversion >= 2.37]):
883+
ctx.logger.warn(
884+
'No network was provided and no ports are connected '
885+
'at server creation time. This is only supported for compute '
886+
'API versions 2.37 and above. '
887+
'Additionally, the network key should be set to \'none\' or '
888+
'\'auto\'. The plugin default is \'none\'.')
889+
server_config['networks'] = 'none'
890+
ctx.instance.runtime_properties['networks'] = 'none'
875891
return
876892
# Try to merge them
877893
elif nics_from_node and nics_from_rels and not allow_multiple:
@@ -1486,6 +1502,8 @@ def _validate_external_volume_connection(openstack_resource):
14861502

14871503

14881504
def _validate_security_groups_on_ports(server_networks, client_config):
1505+
if not isinstance(server_networks, list):
1506+
return
14891507
for net in server_networks:
14901508
if net.get('port'):
14911509
port = OpenstackPort(client_config=client_config,

openstack_plugin/resources/network/port.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,6 @@ def attach(openstack_resource, port_id):
394394
device_id)
395395

396396

397-
398397
@with_compat_node
399398
@with_openstack_resource(OpenstackServer)
400399
def detach(openstack_resource, port_id):
@@ -426,7 +425,6 @@ def create_server_interface(openstack_resource, port_id, **_):
426425
attachment.
427426
:param openstack_resource:
428427
:param port_id:
429-
:param server_id:
430428
:return:
431429
"""
432430
for interface_attachments in openstack_resource.server_interfaces():
@@ -443,7 +441,6 @@ def delete_server_interface(openstack_resource, port_id, **_):
443441
attachment.
444442
:param openstack_resource:
445443
:param port_id:
446-
:param server_id:
447444
:return:
448445
"""
449446
for interface_attachments in openstack_resource.server_interfaces():

plugin.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1715,20 +1715,27 @@ relationships:
17151715
# server is created, usually used if the server need to attached to multiple ports
17161716
cloudify.relationships.openstack.port_connected_to_server:
17171717
derived_from: cloudify.relationships.connected_to
1718-
source_interfaces:
1718+
target_interfaces:
17191719
cloudify.interfaces.relationship_lifecycle:
17201720
postconfigure:
17211721
implementation: openstack.openstack_plugin.resources.network.port.create_server_interface
17221722
inputs:
17231723
port_id:
17241724
default: { get_attribute: [ SOURCE, id ] }
1725+
unlink:
1726+
implementation: openstack.openstack_plugin.resources.network.port.delete_server_interface
1727+
inputs:
1728+
port_id:
1729+
default: { get_attribute: [ SOURCE, id ] }
1730+
source_interfaces:
1731+
cloudify.interfaces.relationship_lifecycle:
17251732
establish:
1726-
implementation: openstack.openstack_plugin.resources.network.port.attach_to_server
1733+
implementation: openstack.openstack_plugin.resources.network.port.attach
17271734
inputs:
17281735
device_id:
17291736
default: { get_attribute: [ TARGET, id ] }
17301737
unlink:
1731-
implementation: openstack.openstack_plugin.resources.network.port.delete_server_interface
1738+
implementation: openstack.openstack_plugin.resources.network.port.detach
17321739
inputs:
17331740
port_id:
17341741
default: { get_attribute: [ SOURCE, id ] }

0 commit comments

Comments
 (0)