Make sure that we dont change data in argument, add deep_copy.

This commit is contained in:
Evgeniy L 2013-08-03 20:16:36 +04:00
parent 608cf8e96f
commit b37536b5de
3 changed files with 20 additions and 1 deletions

View File

@ -19,6 +19,7 @@ require 'logger'
require 'shellwords'
require 'astute/ext/exception'
require 'astute/ext/deep_copy'
require 'astute/config'
require 'astute/logparser'
require 'astute/orchestrator'

View File

@ -57,7 +57,7 @@ class Astute::DeploymentEngine::NailyFact < Astute::DeploymentEngine
attrs_to_puppet['fixed_interface'] = get_fixed_interface(node)
end
attrs_to_puppet.merge!(attrs)
attrs_to_puppet.merge!(deep_copy(attrs))
attrs_to_puppet.each do |k, v|
unless v.is_a?(String) || v.is_a?(Integer)

View File

@ -0,0 +1,18 @@
# Copyright 2013 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
def deep_copy(data)
Marshal.load(Marshal.dump(data))
end