Github user wilderrodrigues commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/587#discussion_r34588816 --- Diff: systemvm/patches/debian/config/opt/cloud/bin/cs/CsFile.py --- @@ -35,10 +35,9 @@ def load(self): self.new_config.append(line) except IOError: logging.debug("File %s does not exist" % self.filename) - return else: logging.debug("Reading file %s" % self.filename) - self.config = copy.deepcopy(self.new_config) + self.config = list(self.new_config) --- End diff -- In the way you put it, accessing the indexes, it changes both probably due to some reference. However, if one adds some other cases - mainly the uso of append(), as we have - you will see that it works. Check below: >>> a = 1 >>> b = [1,2,3] >>> c = "some random string :)" >>> z = [a,b,c] >>> x = list(z) >>> x[1][1] = 100 >>> print x [1, [1, 100, 3], 'some random string :)'] >>> print z [1, [1, 100, 3], 'some random string :)'] >>> z = [] >>> print z [] >>> print x [1, [1, 100, 3], 'some random string :)'] >>> z.append(1) >>> print x [1, [1, 100, 3], 'some random string :)'] >>> print z [1] >>> Now, to show our complete use-case here: for l in file: new_config.append(l) config = list(new_config) Laters, for every new config item, we do: new_config.append(x) or new_config.insert(index, item) By using those operations we won't change the "config" variable. Another example: >>> x = [1,2,3] >>> z = list(x) >>> z.insert(1,5) >>> z [1, 5, 2, 3] >>> x [1, 2, 3] >>> z.append(10) >>> z [1, 5, 2, 3, 10] >>> x [1, 2, 3] >>> What do you think?
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---