Launchpad

port set --security-group: 'Port' object has no attribute 'security_groups'

This bug affects 2 people

Affects Status Importance Assigned to Milestone
python-openstackclient

Fix Released

Undecided

Ankur

Bug Description

Situation:
```
(openstack) port list --long
+------ ------- ------- ------- ------- ----+-- ------- ------- ------- ------- ------- -----+- ------- ------- ----+-- ------- ------- ------- ------- ------- ------- ------- --+---- ----+-- ------- ------- ------- ------- ------- ------- ------- --+---- ------- ------- ------- -+
| ID | Name | MAC Address | Fixed IP Addresses | Status | Security Groups | Device Owner |
+------ ------- ------- ------- ------- ----+-- ------- ------- ------- ------- ------- -----+- ------- ------- ----+-- ------- ------- ------- ------- ------- ------- ------- --+---- ----+-- ------- ------- ------- ------- ------- ------- ------- --+---- ------- ------- ------- -+
| 1ff97542- ab3b-4f91- b8b8-b113f74430 52 | port2 | fa:16:3e:06:1d:10 | ip_address= '192.168. 1.14', subnet_id='8c9c6652 | ACTIVE | 721f6ebc- 8eb3-42da- 9a73-78d7cb30a4 5f | |
| | | | -b87c-46ed- aaab-2982cbe76a a2' | | | |
```

Error:
```
(openstack) port set --security-group c9ee9216- 8d74-4e73- 91d9-26a80e3620 ca 1ff97542- ab3b-4f91- b8b8-b113f74430 52
'Port' object has no attribute 'security_groups'
```

What I would expect: No "has no attribute" error should appear, as this flag is even documented:
```
(openstack) port set -h
usage: port set [-h] [--description <description>] [--device <device-id>]
                  [--device- owner <device-owner>] [--vnic-type <vnic-type>]
                  [--host <host-id>] [--dns-name dns-name]
                  [--enable | --disable] [--name <name>]
                  [--fixed- ip subnet= <subnet> ,ip-address= <ip-address> ]
                  [--no- fixed-ip] [--binding-profile <binding-profile>]
                  [--no- binding- profile] [--security-group <security-group>]
                  [--no- security- group]
                  [--enable- port-security | --disable- port-security]
                  <port>
[...]
  --security-group <security-group>
                           Security group to associate with this port (name or
                           ID) (repeat option to set multiple security groups)
```

Read the original on bugs.launchpad.net ↗