From d151b378dc05b10792ad4eb580817b12f9d21618 Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Wed, 21 May 2014 08:21:13 -0500 Subject: [PATCH] do deep copy before creating CloudClient --- salt/cloud/__init__.py | 7 +++---- salt/modules/cloud.py | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/salt/cloud/__init__.py b/salt/cloud/__init__.py index 37188a4a63..f7e093e813 100644 --- a/salt/cloud/__init__.py +++ b/salt/cloud/__init__.py @@ -178,19 +178,18 @@ class CloudClient(object): self.opts = salt.config.cloud_config(path) if pillars: - cloud_args = pillars.copy() - for name, provider in cloud_args.pop('providers', {}).items(): + for name, provider in pillars.pop('providers', {}).items(): driver = provider['provider'] provider['profiles'] = {} self.opts['providers'].update({name: {driver: provider}}) - for name, profile in cloud_args.pop('profiles', {}).items(): + for name, profile in pillars.pop('profiles', {}).items(): provider = profile['provider'].split(':')[0] driver = self.opts['providers'][provider].keys()[0] profile['provider'] = '{0}:{1}'.format(provider, driver) profile['profile'] = name self.opts['profiles'].update({name: profile}) self.opts['providers'][provider][driver]['profiles'].update({name: profile}) - self.opts.update(cloud_args) + self.opts.update(pillars) def _opts_defaults(self, **kwargs): ''' diff --git a/salt/modules/cloud.py b/salt/modules/cloud.py index 845f467650..4439def220 100644 --- a/salt/modules/cloud.py +++ b/salt/modules/cloud.py @@ -38,7 +38,7 @@ def _get_client(): ''' client = salt.cloud.CloudClient( os.path.join(os.path.dirname(__opts__['conf_file']), 'cloud'), - pillars=__salt__['pillar.get']('cloud', {}) + pillars=copy.deepcopy(__pillar__.get('cloud', {})) ) return client