Revert a few dict usage cleanups from #17080

Turns out our test coverage is missing a few things, upon closer inspection that change broke a few things that we don't seem to have test coverage for.
This commit is contained in:
Thomas Jackson 2014-11-10 07:46:46 -08:00
parent c76ab764c2
commit 81bdc9f9be
5 changed files with 6 additions and 5 deletions

View File

@ -745,7 +745,7 @@ def reformat_node(item=None, full=False):
# remove all the extra key value pairs to provide a brief listing
if not full:
for key in item:
for key in item.keys(): # iterate over a copy of the keys
if key not in desired_keys:
del item[key]

View File

@ -59,7 +59,7 @@ def list_(show_all=False, return_yaml=True):
if 'schedule' in __pillar__:
schedule.update(__pillar__['schedule'])
for job in schedule:
for job in schedule.keys(): # iterate over a copy since we will mutate it
if job == 'enabled':
continue

View File

@ -220,7 +220,7 @@ def render(input, saltenv='base', sls='', argline='', **kws):
tmplctx = STATE_CONF.copy()
if tmplctx:
prefix = sls + '::'
for k in tmplctx:
for k in tmplctx.keys(): # iterate over a copy of keys
if k.startswith(prefix):
tmplctx[k[len(prefix):]] = tmplctx[k]
del tmplctx[k]

View File

@ -202,7 +202,8 @@ class ZeroMQChannel(Channel):
if master_type == 'failover':
# remove all cached sreqs to the old master to prevent
# zeromq from reconnecting to old masters automagically
for check_key in self.sreq_cache:
# iterate over a copy since we will mutate the dict
for check_key in self.sreq_cache.keys():
if self.opts['master_uri'] != check_key[0]:
del self.sreq_cache[check_key]
log.debug('Removed obsolete sreq-object from '

View File

@ -819,7 +819,7 @@ class SaltNova(OpenStackComputeShell):
'priority', 'project_id', 'vlan_start', 'vpn_start'
]
for variable in kwargs:
for variable in kwargs.keys(): # iterate over a copy, we might delete some
if variable not in params:
del kwargs[variable]
return kwargs