[IOT] Fix for iot hub policy delete, deleting all policies. (#4266)

* [IOT] Fix for iot hub policy delete, deleting all policies.

Iot hub policy delete was still deleting all policies rather
than the specified policy.

Observing the policies once seems to release the resources,
setting the desired policy list to empty [].

The fix was to pass a deepcopy of the original policy list into
_is_policy_existed to not prematurely observe the original policies.

* Added new rest recording file.

* Update to history and setup.py based on feedback.

* Changes based on feedback.
This commit is contained in:
Paymaun Heidari 2017-08-24 13:08:14 -07:00 коммит произвёл Travis Prescott
Родитель bacaf80c2c
Коммит 47d740e688
3 изменённых файлов: 2383 добавлений и 2404 удалений

Просмотреть файл

@ -2,6 +2,9 @@
Release History
===============
unreleased
+++++++++++++++
* revisit of bug 3934 -- policy creation no longer clears existing policies.
0.1.10 (2017-07-27)
+++++++++++++++++++

Просмотреть файл

@ -148,9 +148,10 @@ def iot_hub_policy_create(client, hub_name, policy_name, permissions, resource_g
def iot_hub_policy_delete(client, hub_name, policy_name, resource_group_name=None):
import copy
hub = iot_hub_get(client, hub_name, resource_group_name)
policies = iot_hub_policy_list(client, hub_name, hub.resourcegroup)
if not _is_policy_existed(policies, policy_name):
if not _is_policy_existed(copy.deepcopy(policies), policy_name):
raise CLIError('Policy {0} not found.'.format(policy_name))
updated_policies = [p for p in policies if p.key_name.lower() != policy_name.lower()]
hub.properties.authorization_policies = updated_policies

Разница между файлами не показана из-за своего большого размера Загрузить разницу