2016-01-21 14:10:09 |
Richard Theis |
description |
While investigating https://bugs.launchpad.net/python-openstacksdk/+bug/1461200, I found inconsistencies in the resource objects returned by the proxy interface methods. Take the following proxy interface example using network:
example_network = self.conn.network.create_network(
name='openstacksdk-example-project-network')
print(example_network)
for network in self.conn.network.networks():
print(network)
network = self.conn.network.get_network(example_network.id)
print(network)
network = self.conn.network.get_network(example_network)
print(network)
network = self.conn.network.find_network(example_network.id)
print(network)
network = self.conn.network.update_network(example_network.id,
admin_state_up=False)
print(network)
example_network.admin_state_up = False
network = self.conn.network.update_network(example_network)
print(network)
Looking at both resource._attrs and dir(resource) for the network resource, the following inconsistencies were noted:
1) create_network(): resource._attrs only contains the values provided via attrs parameter (i.e. name) and dir(resource) does not contain attributes for port_security_enabled, provider:network_type, provider:physical_network, provider:segmentation_id and router:external.
2) networks(): resource._attrs and dir(resource) are complete
3) get_network(): dir(resource) does not contain attributes for port_security_enabled, provider:network_type, provider:physical_network, provider:segmentation_id and router:external.
4) find_network(): Same as networks().
5) update_network(id): Same as create_network().
6) update_network(resource): Same as get_network().
Some of the resource methods appear to be missing code to update attrs based on the response data. |
While investigating https://bugs.launchpad.net/python-openstacksdk/+bug/1461200, I found inconsistencies in the resource objects returned by the proxy interface methods. Take the following proxy interface example using network:
example_network = self.conn.network.create_network(
name='openstacksdk-example-project-network')
print(example_network)
for network in self.conn.network.networks():
print(network)
network = self.conn.network.get_network(example_network.id)
print(network)
network = self.conn.network.get_network(example_network)
print(network)
network = self.conn.network.find_network(example_network.id)
print(network)
network = self.conn.network.update_network(example_network.id,
admin_state_up=False)
print(network)
example_network.admin_state_up = False
network = self.conn.network.update_network(example_network)
print(network)
Looking at both resource._attrs and dir(resource) for the network resource, the following inconsistencies were noted:
1) create_network(): resource._attrs only contains the values provided via attrs parameter (i.e. name) and dir(resource) does not contain attributes for port_security_enabled, provider:network_type, provider:physical_network, provider:segmentation_id and router:external.
2) networks(): resource._attrs and dir(resource) are complete
3) get_network(): dir(resource) does not contain attributes for port_security_enabled, provider:network_type, provider:physical_network, provider:segmentation_id and router:external.
4) find_network(): Same as networks().
5) update_network(id): Same as create_network().
6) update_network(resource): Same as get_network().
Some of the resource methods appear to be missing code to update attrs based on the response data.
Update from related bug https://bugs.launchpad.net/python-openstacksdk/+bug/1474478:
I'm not sure why resource create only updates the id attribute
https://github.com/stackforge/python-openstacksdk/blob/master/openstack/resource.py#L569
Why not just grab whatever attributes are available? Might be some created_at etc type attributes to add. |
|