install.upgrade: deepcopy() overrides before we modify it

Since we modify the dict, make sure it is a deep copy.
Otherwise, a sequence like:

- install.upgrade:
    all:
      branch: dumpling
...
- install.upgrade:
    all: null

will delete the overrides keys in the first upgrade call and
then not have them at all in the second.

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-11-01 17:45:52 -07:00
parent 3e72dcb9f4
commit 92c57f17f4

View File

@ -1,6 +1,7 @@
from cStringIO import StringIO
import contextlib
import copy
import logging
import time
@ -1023,7 +1024,7 @@ def upgrade(ctx, config):
if not node:
node = {}
this_overrides = install_overrides
this_overrides = copy.deepcopy(install_overrides)
if 'sha1' in node or 'tag' in node or 'branch' in node:
log.info('config contains sha1|tag|branch, removing those keys from override')
this_overrides.pop('sha1', None)