From f8e5515640854682943362f075e0cac151bc5e06 Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <blacklight86@gmail.com>
Date: Fri, 15 Feb 2019 11:45:11 +0100
Subject: [PATCH] Make a copy of the procedure arguments before expanding the
 values from the context, or we'll permanently overwrite the procedure
 arguments with expanded values

---
 platypush/procedure/__init__.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/platypush/procedure/__init__.py b/platypush/procedure/__init__.py
index 1957f233..0247b480 100644
--- a/platypush/procedure/__init__.py
+++ b/platypush/procedure/__init__.py
@@ -121,11 +121,12 @@ class Procedure(object):
             n_tries -- Number of tries in case of failure before raising a RuntimeError
         """
         if self.args:
-            for (k,v) in self.args.items():
+            args = self.args.copy()
+            for (k,v) in args.items():
                 v = Request.expand_value_from_context(v, **context)
-                self.args[k] = v
+                args[k] = v
                 context[k] = v
-            logger.info('Executing procedure {} with arguments {}'.format(self.name, self.args))
+            logger.info('Executing procedure {} with arguments {}'.format(self.name, args))
         else:
             logger.info('Executing procedure {}'.format(self.name))