update command is broken when used via client api

Bug #1371167 reported by Pavlo Shchelokovskyy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-heatclient
Fix Released
High
Tatiana Kholkina

Bug Description

When heatclient is used not via CLI but via python API it presents, stack update is broken as it now requires 'existing' argument.

File "/opt/stack/python-heatclient/heatclient/v1/stacks.py", line 125, in update
    method = 'PATCH' if kwargs['existing'] else 'PUT'
MuranoPlException: [exceptions.KeyError]: 'existing'

Looks like the change I30a2b223d7dd19a717ed989b419b1e6cb2ac143b was not backward-compatible.

Changed in python-heatclient:
assignee: nobody → Pavlo Shchelokovskyy (pshchelo)
Revision history for this message
Steve Baker (steve-stevebaker) wrote :

kwargs.get('existing') should be sufficient

Changed in python-heatclient:
status: New → Triaged
importance: Undecided → High
Changed in python-heatclient:
assignee: Pavlo Shchelokovskyy (pshchelo) → nobody
Changed in python-heatclient:
assignee: nobody → Tetyana Lashchova (tlashchova)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-heatclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/122690

Changed in python-heatclient:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-heatclient (master)

Reviewed: https://review.openstack.org/122690
Committed: https://git.openstack.org/cgit/openstack/python-heatclient/commit/?id=f960906c600f4da169b96684d424b0edc9460507
Submitter: Jenkins
Branch: master

commit f960906c600f4da169b96684d424b0edc9460507
Author: Tetyana Lashchova <email address hidden>
Date: Fri Sep 19 12:17:38 2014 +0300

    Fix stack update for Python API

    Change I30a2b223d7dd19a717ed989b419b1e6cb2ac143b
    introduced 'existing' keyword to stack-udpate command that became effectively
    required argument to stack.update method of the client's Python API,
    breaking backward compatibility.

    Change-Id: Icda3313805c29ab36773a4edc8c9f8c874b71ca3
    Closes-Bug: #1371167

Changed in python-heatclient:
status: In Progress → Fix Committed
Revision history for this message
Yaroslav Lobankov (ylobankov) wrote :

It seems the fix has not helped.

2014-09-23 06:54:10.497 TRACE sahara.service.ops Traceback (most recent call last):
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/sahara/sahara/service/ops.py", line 130, in wrapper
2014-09-23 06:54:10.497 TRACE sahara.service.ops if _rollback_cluster(cluster, ex):
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/sahara/sahara/service/ops.py", line 153, in _rollback_cluster
2014-09-23 06:54:10.497 TRACE sahara.service.ops return INFRA.rollback_cluster(cluster, reason)
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/sahara/sahara/service/heat_engine.py", line 108, in rollback_cluster
2014-09-23 06:54:10.497 TRACE sahara.service.ops cluster, rollback_count, target_count, reason)
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/sahara/sahara/service/heat_engine.py", line 175, in _rollback_cluster_scaling
2014-09-23 06:54:10.497 TRACE sahara.service.ops launcher.launch_instances(cluster, rollback_count)
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/sahara/sahara/service/heat_engine.py", line 208, in launch_instances
2014-09-23 06:54:10.497 TRACE sahara.service.ops disable_rollback=self.DISABLE_ROLLBACK)
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/sahara/sahara/utils/openstack/heat.py", line 135, in instantiate
2014-09-23 06:54:10.497 TRACE sahara.service.ops stack.update(**kwargs)
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/python-heatclient/heatclient/v1/stacks.py", line 33, in update
2014-09-23 06:54:10.497 TRACE sahara.service.ops self.manager.update(self.identifier, **fields)
2014-09-23 06:54:10.497 TRACE sahara.service.ops File "/opt/stack/python-heatclient/heatclient/v1/stacks.py", line 125, in update
2014-09-23 06:54:10.497 TRACE sahara.service.ops method = 'PATCH' if kwargs.pop('existing', None) else 'PUT'
2014-09-23 06:54:10.497 TRACE sahara.service.ops KeyError: 'existing'

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

What is the Python version this being run on?

Revision history for this message
Pavlo Shchelokovskyy (pshchelo) wrote :

this is very strange, as on all Python versions supported by OpenStack (2.6, 2.7, 3.3) according to docs, dict.pop(key, default) method can not return KeyError if default is specified.

Python 2.7

>>> {}.pop('a')
KeyError: 'a'

>>> {}.pop('a', None) is None
True

Revision history for this message
Yaroslav Lobankov (ylobankov) wrote :

This issue isn't reproduced any more.

Changed in python-heatclient:
milestone: none → v0.2.12
Changed in python-heatclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.